Updated

In a bittersweet landmark, European Union leaders on Sunday approved an agreement on Britain's departure next year — the first time a member country will have left the 28-nation bloc.

It took leaders a matter of minutes at a summit in Brussels to endorse a 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 rubber-stamped a 26-page document laying out their aims for future relations after Britain leaves in March.

Barely half an hour after leaders sat down, European President Donald Tusk tweeted: "EU27 has endorsed the Withdrawal Agreement and Political Declaration on the future EU-UK relations."

British Prime Minister Theresa May, waiting in the wings as the other leaders met, joined them once they had given the deal the seal of approval to discuss the next steps on the road to Brexit.

European Commission President Jean-Claude Juncker, right, shakes hands with British Prime Minister Theresa May prior to a meeting at EU headquarters in Brussels, Saturday, Nov. 24, 2018.

European Commission President Jean-Claude Juncker, right, shakes hands with British Prime Minister Theresa May prior to a meeting at EU headquarters in Brussels, Saturday, Nov. 24, 2018. (AP Photo/Geert Vanden Wijngaert)

May has hailed the deal as the start of a new chapter for Britain, but European Commission President Jean-Claude Juncker said the U.K.'s departure was a tragedy.

"It's a sad day," Juncker said as he arrived.

BREXIT CHAOS CONTINUES AS UK'S THERESA MAY WARNS AGAINST A LEADERSHIP CHANGE

He told reporters that deal was "the best possible," but the summit "is neither a time of jubilation nor of celebration. It's a sad moment, and it's a tragedy."

The agreement paves the way for Britain's smooth departure from the bloc from the EU side, though a bumpy ride still awaits in the U.K.

In a formal statement endorsing the deal, the leaders called on EU institutions "to take the necessary steps to ensure that the agreement can enter into force on 30 March 2019, so as to provide for an orderly withdrawal."

The U.K. is due to leave the EU at midnight Brussels time on March 29.

EU chief negotiator Michel Barnier said now that the first phase was done, Britain and the EU needed to work for "an ambitious and unprecedented partnership."

"Now is the time for everybody to take their responsibility — everybody," he said.

UK'S MAY SEES BREXIT DEAL SOON AS FUTURE TIES TEXT AGREED

Dutch Prime Minister Mark Rutte said the deal — the product of a year and a half of often grueling negotiations between Britain and the EU — 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."

German Chancellor Angela Merkel, left, speaks with European Commission President Jean-Claude Juncker during a round table meeting at an EU summit in Brussels, Sunday, Nov. 25, 2018.

German Chancellor Angela Merkel, left, speaks with European Commission President Jean-Claude Juncker during a round table meeting at an EU summit in Brussels, Sunday, Nov. 25, 2018. (AP Photo/Geert Vanden Wijngaert)

The last big obstacle to a deal was overcome on Saturday, when Spain lifted its objections over the disputed British territory of Gibraltar.

The deal must still be ratified by the European Parliament, something parliament President Antonio Tajani said would likely take place early in 2019.

Tajani said a "large majority" of European parliamentarians supported the deal.

More dauntingly for May, it also needs approval from Britain's Parliament.

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 the House of Commons next month. Brexiteers think it will leave the U.K. tied too closely to EU rules, while pro-Europeans say it will erect new barriers between Britain and the bloc — its neighbor and biggest trading partner.

Pro-Brexit Conservative lawmaker Iain Duncan Smith said Sunday that May should demand new conditions from the EU. He said the deal as it stands "has ceded too much control" to Brussels.

May insists her deal delivers on the things that matter most to pro-Brexit voters — control of budgets, immigration policy and laws — while retaining close ties to the U.K.'s European neighbors.

And EU leaders warned that Britain could not hope to get a better offer.

"This is the deal, it's the best possible and the European Union won't change its fundamental position when it comes to this issue," Juncker said.

May plans to spend the next couple of weeks selling it to politicians and the British public before Parliament's vote in December.

French President Emmanuel Macron arrives for an EU summit at the Europa building in Brussels, Sunday, Nov. 25, 2018.

French President Emmanuel Macron arrives for an EU summit at the Europa building in Brussels, Sunday, Nov. 25, 2018. (Piroschka van de Wouw, Pool Photo via AP)

In a "letter to the nation" released Sunday, May said she would be "campaigning with my heart and soul to win that vote and to deliver this Brexit deal, for the good of our United Kingdom and all of our people."

"It will be a deal that is in our national interest - one that works for our whole country and all of our people, whether you voted 'Leave' or 'Remain,'" she said.

She said Britain's departure from the EU "must mark the point when we put aside the labels of 'Leave' and 'Remain' for good and we come together again as one people."

"To do that we need to get on with Brexit now by getting behind this deal."

In a bittersweet landmark, European Union leaders on Sunday approved an agreement on Britain's departure next year — the first time a member country will have left the 28-nation bloc.