“People in Gibraltar need to understand that the alternative to a treaty is potentially the full application of the Schengen border code with all of the massive difficulties that that would entail, and for us to do it reciprocally,” Mr Picardo said.
“In other words, if the Schengen border code is applied to Gibraltar and to crossings from Gibraltar to Spain, the government of Gibraltar will apply the same rules to crossings from Spain to Gibraltar. We will do that more in sorrow than in anger.”
The first minister said that a possible fallback would be a bilateral local border traffic agreement with Spain but that would be “unambitious”.
“The reality is that we may fail to do a treaty, and we may also fail to agree a local border traffic arrangement,” he said.
The last round of negotiations between Lord Cameron, José Manuel Albares, the Spanish foreign secretary, and Maros Sefcovic, of the European Commission, floundered over the issue of Spanish police operating at the airport.
It was thought that issue had been solved by having guards from Frontex, the EU border agency, policing the new Schengen border at the airport, which is a short walk from the current frontier.
But the issue remains problematic, especially as Madrid claims sovereignty over Gibraltar, which it calls a colony.
There was alarm when Spain’s government admitted last month that it expected armed uniformed Spanish police officers to implement border controls at the airport and maritime entry points.
In a written reply to a parliamentary question in Spain’s Senate, the Spanish government said: “The Policia Nacional must carry out border controls. If Frontex agents are present, their role should be to support and complement the Policia Nacional.”
It added that the Policia Nacional must be “able to move freely throughout the entire border area” and that officers “must serve in uniform” and would “carry weapons while performing their duties”.
“Spain needs to be understanding of why the Gibraltarian rejects Spanish presence in Gibraltar. It’s a product of 60 years of what I might call almost abuse,” Mr Picardo said.
“We’ve seen the Spanish law enforcement agencies in Gibraltar as the instrument of the Spanish attempt not to recognise our waters and our territory.”
Tory Brexiteer backbenchers had also raised security concerns over the airport, which is an RAF military base, and other sovereignty implications for the deal.
The Telegraph understands that agreement in principle has been reached on some strands of the deal, including an agreement allowing Spanish and other EU planes to land at Gibraltar airport for the first time in more than a decade.
This would bring a tourism boost to the poor Spanish region close to Gibraltar, thanks to the airport, which currently only takes flights to and from the UK.
A source said one idea would be for Spain and Gibraltar to set up a joint venture to manage such commercial flights, which would be ring-fenced from the RAF military base.
“The commission remains committed to reach an EU-UK agreement for the benefit of the whole region. The teams remain in touch,” a European Commission spokesman said.