European Union leaders will agree in principle on a transition period for the UK – on condition that the UK reaches agreement with Spain over Gibraltar.

The president of the European council, Donald Tusk, promised Spain that its veto over Gibraltar’s inclusion in the agreement would be emphasised at this week’s summit.

As reported by The Guardian, Tusk was forced into last-minute talks with Madrid after David Davis, the Brexit secretary, spooked the Spanish government with his insistence on March 19 that the Rock would enjoy the same benefits as the rest of the UK in the 21-month period after Brexit.

The EU leaders will now endorse the transition period terms on March 23, but will publicly reiterate their position that Downing Street must come to a bilateral agreement with Spain over the future of Gibraltar if the disputed territory is to stay in the single market and customs union until 31 December 2020.

Leaked to The Guardian, the final draft of the EU’s guidelines now call “for intensified efforts… on issues related to the territorial application of the withdrawal agreement, notably as regards Gibraltar, and reiterates that nothing is agreed until everything is agreed”.

Speaking in Brussels, Tusk said: “On Brexit, I have some good news for Prime Minister Theresa May. News that has been awaited in London but also in all the other EU capitals. I have just recommended to our leaders that we welcome in principle the agreement on transition. In practice, the transition phase will allow us to delay all the negative consequences of Brexit by another 21 months.”

He added: “It is important not least for our people and businesses to bide this time so that everyone is prepared for the real impact of Brexit.”

However, diplomats were keen to emphasise on Wednesday that, even with the endorsement of the leaders, nothing was concrete until all the outstanding issues were resolved.