European Commission President Jean-Claude Juncker, center, kisses European Union chief Brexit negotiator Michel Barnier, right, as European Council President Donald Tusk looks on after a media conference at the conclusion of an EU summit in Brussels, Sunday, Nov. 25, 2018. European Union gathered Sunday to seal an agreement on Britain's departure from the bloc next year, the first time a member country will have left the 28-nation bloc. (AP Photo/Geert Vanden Wijngaert)

European Commission President Jean-Claude Juncker, center, kisses European Union chief Brexit negotiator Michel Barnier, right, as European Council President Donald Tusk looks on after a media conference at the conclusion of an EU summit in Brussels, Sunday, Nov. 25, 2018. European Union gathered Sunday to seal an agreement on Britain's departure from the bloc next year, the first time a member country will have left the 28-nation bloc. (AP Photo/Geert Vanden Wijngaert)

BRUSSELS (AP) — After months of hesitation, stop-and-start negotiations and resignations, Britain and the European Union on Sunday finally sealed an agreement governing the U.K.’s departure from the bloc next year.

So much for the easy part.

British Prime Minister Theresa May must now sell the deal to her divided Parliament — a huge task considering the intense opposition from pro-Brexit and pro-EU lawmakers alike — to ensure Britain can leave with a minimum of upheaval on March 29.

It’s a hard sell. The agreement leaves Britain outside the EU with no say but still subject to its rules and the obligations of membership at least until the end of 2020, possibly longer. Britons voted to leave in June 2016, largely over concerns about immigration and losing sovereignty to Brussels.

ADVERTISEMENT

EU leaders were quick to warn that no better offer is available.

“I am totally convinced this is the only deal possible,” European Commission President Jean-Claude Juncker said. “Those who think that by rejecting the deal that they would have a better deal will be disappointed the first seconds after the rejection.”

For once, May was in complete agreement.

“This is the deal that is on the table,” she said. “It is the best possible deal. It is the only deal.”

Acknowledging the vast political and economic consequences of Brexit, May promised lawmakers their say before Christmas and said that it “will be one of the most significant votes that Parliament has held for many years.”

She argued that Parliament has a duty “to deliver Brexit” as voters have demanded.

“The British people don’t want to spend any more time arguing about Brexit,” she said. “They want a good deal done that fulfils the vote and allows us to come together again as a country.”

Not all agree. Main opposition Labour Party leader Jeremy Corbyn called the deal “the result of a miserable failure of negotiation that leaves us with the worst of all worlds,” and said his party would oppose it. Scottish First Minister Nicola Sturgeon, whose Scottish National Party is the third-largest in Parliament, said lawmakers “should reject it and back a better alternative.”

Pro-Brexit former Conservative leader Iain Duncan Smith said May should insist on new terms because the deal “has ceded too much control” to Brussels.

On the EU side, the last big obstacle to a deal with Britain was overcome Saturday when Spain lifted its objections over the disputed British territory of Gibraltar.

ADVERTISEMENT

So it took EU leaders only a matter of minutes at Sunday’s summit in Brussels to endorse the withdrawal agreement that settles Britain’s divorce bill, protects the rights of U.K. and EU citizens hit by Brexit and keeps the Irish border open. They also backed a 26-page document laying out their aims for relations after Brexit.

Still, the event was tinged with sadness on the European side at Britain’s departure, the first time a country will leave the 28-nation bloc.

German Chancellor Angela Merkel said her feelings were “ambivalent, with sadness, but on the other hand, also some kind of relief that we made it to this point.”

“I think we managed to make a diplomatic piece of art,” she said.

Dutch Prime Minister Mark Rutte said the deal — the product of a year and a half of often- grueling negotiations — was regrettable but acceptable.

“I believe that nobody is winning. We are all losing because of the U.K. leaving,” Rutte said. “But given that context, this is a balanced outcome with no political winners.”

May said she wasn’t sad, because Britain and the EU would remain “friends and neighbors.”

“I recognize some European leaders are sad at this moment, but also some people back at home in the U.K. will be sad at this moment,” she told reporters, but insisted that she was “full of optimism” about Britain’s future.

The European Parliament, meanwhile, will be in full campaign mode a few months ahead of the EU elections when Europe’s lawmakers sit to endorse the agreement, probably in February, but perhaps as late as March, according to the assembly’s president, Antonio Tajani.

Still, Tajani said a “large majority” of European parliamentarians support the deal.

Many predict it will fail in the British Parliament. No one can be sure whether that would lead to the fall of the government, a new referendum, a postponement of Brexit or a chaotic “no deal” exit for Britain.

But Irish Prime Minister Leo Varadkar said he thought May’s chances of getting the agreement through Parliament were strong.

He said British lawmakers would see that “the alternative is a no deal, cliff-edge Brexit, which is something of course that we all want to avoid.”

“Any other deal really only exists in people’s imaginations,” he added.

___

Associated Press writers Gregory Katz in London and Kirsten Grieshaber in Berlin contributed.

___

See the AP’s Brexit coverage at: https://www.apnews.com/Brexit