Britain is set to be pulled into talks with Spain and the EU about the status of Gibraltar after Brexit, under a roadmap for future negotiations set to be agreed by EU leaders on Friday.

Spain threatened to block progress in Brexit talks this week after David Davis said in passing that the Brexit withdrawal agreement would apply to the British tax haven – reigniting long-held anxieties in Madrid about the British presence there.

As recently as Tuesday senior EU officials said “concerned member countries” – which later turned out to be Spain – were refusing to back the agreement in preparatory meetings for the summit.

By Wednesday evening diplomats were indicating that the Spanish government had relented on the issue, but on the condition that the 27 EU member states include Gibraltar high up on the list of issues they say must be resolved.

The question under discussion will be whether the withdrawal agreement and transition period agreed between David Davis and Michel Barnier applies to Gibraltar as it would to the rest of the UK.

A final draft of the European Council guidelines, widely expected to be agreed by heads of government at a Brussels summit on Friday, but leaked in advance to The Independent says:

“The European Council calls for intensified efforts on the remaining withdrawal issues as well as issues related to the territorial application of the Withdrawal Agreement, notably as regards Gibraltar, and reiterates that nothing is agreed until everything is agreed,” 

The clause, the very first part of the draft text, effectively says the issue of Gibraltar must be resolved before a deal can be struck, and alludes to the fact that Spain has a veto on the entire deal, in common with the other EU member states.

It will be formally signed off by the 27 other EU leaders in the second day of the European Council summit on Friday, after Theresa May goes home following dinner on Thursday night.

On Thursday night Ms May will address leaders over dinner about Brexit, and also update them on the state of the investigation into the Salisbury poisoning. The British government is hoping for a strong statement condemning Russia for the attack, but is not pushing for additional sanctions against Vladimir Putin’s regime.

Other issues on the summit’s packed agenda include a tax on digital tech giants, the response to growing trade dispute over steel tariffs with Donald Trump’s administration, and relations with the Western Balkans countries, which hope to join the EU. 

Spain claims Gibraltar, a British Overseas Territory, is part of Spain, because of its location on the Iberian peninsula. The rock has been under British control since 1704 when it was captured during the war of Spanish succession.

The Spanish monarchy repeatedly ceded the area to Britain in a series of treaties over the following decades, but government policy changed under General Franco’s rule, and Spain has since officially wanted it back.