The relationship between the UK and Spain is as old as the history of our two countries. We are bound by a friendship based on values which we still share today: freedom, democracy, the separation of powers and the rule of law.

The rich historical and cultural bond that unites two of the oldest monarchies in the world is reflected in our close political relations. We also have close ties from an economic and trade perspective. The facts speak for themselves: the UK is our fourth largest customer and our seventh largest supplier. In 2016, Spanish exports to Britain amounted to €19.15bn, with imports of €11.18bn. We are visited by more citizens from the UK than from any other country. And more than half a million Spanish and British citizens have chosen to live in the UK and Spain respectively.

The UK is our main investment destination, with a stock of €82bn in 2015, and the second largest investor in Spain (€44.62bn). Spanish companies in the UK operate in industries including finance, telecommunications and energy supply. The UK is also very present in Spain with significant investments in, for instance, the telecommunications industry.

Citizens are our priority: we must give them certainty and reassurance, and safeguard their rights and interests

On 23 June 2016, the British people made a decision which we respect, and which confronts us with a complex challenge: to ensure the UK’s orderly exit from the EU and find a new framework for all manner of relations that for 44 years took place within the union. I would not want to exaggerate or underestimate the difficulty of the task ahead.

Citizens are our priority: we must give them certainty and reassurance, and safeguard their rights and interests. It is also essential to ensure businesses can continue operating in a context of legal security and predictability. Doing otherwise would significantly discourage investment, growth and job creation. It is our obligation as leaders to minimise, as far as possible, the impact of this decision on our citizens. It is a matter of pragmatism, but also of justice.

The situation has progressed substantially since the important speech Theresa May gave in Florence in September. Her proposals and constructive spirit have made the talks move forward significantly. I hope that a reasonable agreement which respects the interests of all parties can be reached regarding the financial settlement and the Irish border, preserving the Good Friday agreement.

Time is short. On 14 and 15 December, the European council will meet in Brussels: we are on the verge of an agreement and I hope we will soon be able to move on to the second phase of negotiations. The two teams are making invaluable efforts. I would like to point out that the EU’s lead negotiator, Michel Barnier, has Spain’s full support and trust.

The United Kingdom is leaving the European Union, but not Europe. The aim will be to build a strategic alliance to respond to the common challenges and goals of the 21st century: job creation, migration, climate change, development, cybersecurity and terrorism.

We must not forget that the UK and Spain have always stood firm and united in their fight against the scourge of terrorism, which continues to cause great pain and which has struck both our countries this year. I am convinced that, together, we will be able to better stand up to any challenge.

Our unity can also be seen in the firmness and clarity of May’s government in the face of the events that have recently taken place in the autonomous region of Catalonia.

Britain’s stance is particularly important, as it is the cradle of parliamentarism and the rule of law. I hope that the coming regional elections in Catalonia will allow us to return to the normality and stability that our institutions require and our citizens deserve.

Winston Churchill, whose family history is linked to the Spanish war of succession, said: “The farther back you can look, the farther forward you can see.” The history of our nations is inextricably intertwined, and will continue to be so. Britain can count on Spain’s loyal and sincere friendship. We want the best for the UK, because it is simply another way of wishing the same for Spain.

• Mariano Rajoy is prime minister of Spain