Brussels, Nov 24 (AP) The European Union removed the last major obstacle to sealing an agreement on Brexit after Spain said it had reached a deal Saturday with Britain over Gibraltar on the eve of an EU summit.

British Prime Minister Theresa May, who arrived in Brussels Saturday evening for preparatory talks with EU leaders, will then have the momentous task of selling the deal to a recalcitrant British Parliament and a nation still fundamentally split over whether the U.K. should leave the EU on March 29 and under what conditions.

Spanish Prime Minister Pedro Sanchez announced Saturday that Madrid would support the Brexit divorce deal after the UK and the EU agreed to give Spain a say in the future of the disputed British territory of Gibraltar, which lies at the southern tip of the Mediterranean nation.

Spain wants the future of the tiny territory, which was ceded to Britain in 1713 but is still claimed by Spain, to be a bilateral issue between Madrid and London, not between Britain and the EU.

In a letter obtained by The Associated Press, European Commission President Jean-Claude Juncker and European Council President Donald Tusk assured Sanchez that Spain's "prior agreement" would be needed on matters concerning Gibraltar.

"Europe and the United Kingdom have accepted the conditions imposed by Spain," Sanchez said. "Therefore, as a consequence of this, Spain will lift its veto and tomorrow will vote in favor of Brexit." The move should allow EU leaders speedily to sign off on the Brexit agreement between Britain and a special summit Sunday morning.

Sanchez said the agreement reached would give Spain "absolute guarantees to resolve the conflict that has lasted for more than 300 years before Spain and the UK."

May was on her way to Brussels when the deal came through and hopes to leave EU headquarters on Sunday with a firm agreement on the withdrawal terms for Britain's departure from the EU on March 29, as well as a comprehensive negotiating text on how future relations should look like once both sides agree on a trade agreement.

May met with Juncker and was to have dinner with Tusk on Saturday evening. Winning warm greetings from her 27 fellow leaders on Sunday might be much easier for May these days than getting such treatment from her colleagues in government and Parliament once she returns. May is under intense pressure from pro-Brexit and pro-EU British lawmakers, with large numbers on both sides of the debate opposing the divorce deal and threatening to vote it down when it comes to Parliament next month.

The leader of Northern Ireland's Democratic Unionist Party, on which May relies to get her government majority, on Saturday rejected her planned Brexit deal, arguing it would drive a wedge between Northern Ireland and the rest of the United Kingdom.

Arlene Foster said in Belfast that the deal agreed by May is unacceptable and must be improved upon in the weeks ahead. AP NSA

(This is an unedited and auto-generated story from Syndicated News feed, LatestLY Staff may not have modified or edited the content body)