LONDON — Nothing is simple in Brexitland.

In the lead-up to a historic summit Sunday in Brussels, where a Brexit deal is expected to be rubber-stamped, tiny Gibraltar suddenly loomed large.

It literally put Britain’s European Union divorce settlement between “The Rock” and a hard place for a time. That’s because Spanish Prime Minister Pedro Sánchez insisted his country have final say over any future status of the enclave, a self-governing British territory on the tip of southern Spain and near the narrow mouth of the Mediterranean.


The Rock of the British overseas territory of Gibraltar, historically claimed by Spain, is seen from the city of La Linea de la Concepción in southern Spain on Saturday. (Jon Nazca/Reuters)

Spain, which has had a centuries-long feud with Britain over Gibraltar, wanted Britain to make a commitment in writing before the summit.

It went down to the wire. Late week, Sánchez said Spain would lift its veto because the European Union and Britain had accepted Spain’s demands. The summit, he said, could go ahead now that he had received written assurances that meant that in the future Madrid and London could directly negotiate on Brexit issues relating to Gibraltar.

On Sunday, the leaders of the 28 E.U. countries are expected to meet in Brussels at a carefully choreographed summit to approve Brexit plans and an accompanying political declaration on the future ties between Britain and the 27 E.U. nations that will say goodbye officially in March.

The Brexit package, which is very much British Prime Minister Theresa May’s deal, has been painstakingly crafted. But it’s been a tortured path: 17 months of sometimes bitter negotiations, nonstop bickering within May’s own leadership team, ongoing concerns about how to handle the border between E.U.-member Ireland and Northern Ireland, the resignation of a string of ministers including two Brexit secretaries, and a new vocabulary of Brexit-related puns and put-downs from British tabloids.

Around 30,000 Britons live in Gibraltar, a 2.6-square-mile rocky outpost that shares a land border with Spain. It was famously the headquarters for Gen. Dwight D. Eisenhower during the planning stages of the Allied invasion of North Africa in 1942.

The sovereignty issues around Gibraltar may have hit the headlines this week, but they are long-festering. Gibraltar was ceded to Britain in 1713 under the Treaty of Utrecht, but it is still claimed by Spain. In a 2002 referendum, its citizens overwhelming rejected a proposal of joint British-Spanish rule, instead opting to remain under the sovereignty of Britain only.

But the two countries have deep ties with each other — an estimated 12,000 workers cross the border every day. In the 2016 E.U. referendum, Gibraltarians voted 96 percent to remain in the European Union.

May has said any Brexit deal must apply to the “whole U.K. family,” including Gibraltar.

Spain can’t officially “veto” the withdrawal agreement, a 585-page legally binding agreement, but the E.U. has worked hard at presenting a united front during Brexit negotiations and it wanted a consensus Sunday.

Donald Tusk, the president of the European Council, tweeted on Saturday afternoon that there was unity and solidarity from the E.U. side. He added: “No one has reasons to be happy.”

Even with the Gibraltar issue solved at the 11th hour, May’s headaches are far from over. If the deal is finalized in Brussels this weekend, as expected, May still needs to convince the majority of British lawmakers to back her deal — arguably her biggest challenge yet.