Leaders of 27 European Union nations on Sunday endorsed an agreement detailing the terms and conditions on which Britain will leave the bloc on March 19, 2019.
"EU27 has endorsed the Withdrawal Agreement and Political Declaration on the future EU-UK relations," European Council President Donald Tusk announced on Twitter.
Later, Tusk posted another tweet saying that despite "the difficult process of ratification" and negotiations to come, the EU and Britain would always remain friends.
The proposed deal outlines how Britain can keep close to the EU market after a two to four-year transition. The treaty also covers financial matters, citizens' rights and Brexit's impact on Northern Ireland, and sets out hopes for future security and trade ties between the EU and Britain.
Read more: The draft Brexit deal: What you need to know
Negotiations continued up to the last minute on the 585-page withdrawal agreement, which has drawn fierce criticism from euroskeptics as well as pro-EU politicians in Britain.
But Tusk urged all EU countries to approve the deal, which was forged after 17 months of tough negotiations. Tusk said that terms that had been agreed with Britain would "reduce the risks and losses" once Brexit is complete.
Spain, which had threatened to boycott the Brussels summit, decided to attend the summit in Brussels after a disagreement over Gibraltar was resolved on Saturday.
'Sad' but necessary
European Commission President Jean-Claude Juncker said Brexit was not a "moment of joy or celebration."
"It's a sad moment and it's a tragedy," he said after arriving for the summit in Brussels.
But Dutch Prime Minister Mark Rutte said that given the situation, the agreement was acceptable. "Overall, I think this is the maximum that we can all do, both Theresa May and her government as well as the European Union," he said in Brussels.
"No victors here today, nobody winning, we're all losing," he added.
Michel Barnier, the EU's Brexit negotiator, said that despite the drawback, all sides needed to act responsibly to ensure Britain's orderly departure from the European bloc.
"No, it's time for everybody to take their responsibility," Barnier said, describing the deal as a "necessary step" to build trust between Britain and the EU. "We will remain allies, partners and friends."
Read more: Opinion: Gibraltar dispute shows the absurdity of Brexit
However, even though EU leaders approved the deal on Sunday, it needs to be passed by the UK parliament, where many lawmakers, including from Prime Minister Theresa May's own Conservative Party, vehemently oppose it. Many MPs have warned they will vote against it.
Even those in favor of Britain's divorce from the EU dislike the deal, particularly the so-called backstop aimed at preventing the re-emergence of a hard border on the island of Ireland after Northern Ireland leaves the EU along with Britain.
Euroskeptics in May's Conservative Party and their Northern Irish allies, the Democratic Unionist Party (DUP), argue the treaty will keep Britain too close to the EU.
After EU leaders endorsed the deal, DUP leader Arlene Foster told broadcaster BBC that she would "review" the "confidence and supply" agreement propping up the minority Conservative government if the treaty were passed by Parliament.
Foreign Secretary Jeremy Hunt told the same broadcaster the parliamentary "arithmetic" for approving the deal was "challenging," but that it would entail "very big risks" for the country if MPs were to reject it.
'In our national interest'
But in an open "letter to the nation" on Sunday, May claimed the deal was "in our national interest" and worked for all parts of the UK.
She said that Brexit could be "a moment of renewal and reconciliation."
"To do that we need to get on with Brexit now by getting behind this deal," she added.
Read more: No-deal Brexit fears on minds of German manufacturers
shs/tj (dpa, AFP, Reuters, AFP)
Each evening at 1830 UTC, DW's editors send out a selection of the day's hard news and quality feature journalism. You can sign up to receive it directly here.