European Union leaders have unanimously backed a new Brexit deal with Britain, leaving Prime Minister Boris Johnson facing a battle to secure the UK Parliament's backing for the agreement if he is to take Britain out of Europe on Oct 31.
Speaking after the EU's 27 other leaders had endorsed the deal without Johnson in the room, European Commission President Jean-Claude Juncker declared himself pleased that an agreement had been reached but unhappy to see Britain go.
"All in all, I am happy, relieved that we reached a deal," he said. "But I am sad because Brexit is happening."
Those sentiments were echoed by the EU's chief negotiator, Michel Barnier, and by Donald Tusk, president of the European Council, who has been a vocal opponent of Brexit.
"On a more personal note, what I feel today is sadness," Tusk told reporters. "Because in my heart, I will always be a remainer. And I hope that if our British friends decide to return one day, our door will always be open."
British and EU negotiators reached the agreement early today after successive days of late-night talks and nearly three years of heated discussions that have strained EU-UK ties at a time the bloc is facing a wave of euroscepticism, struggling to restart economic growth and take a stand against resurgent global powers China and Russia.
Johnson (photo) said he was confident that the House of Commons, which will sit for an extraordinary session on Saturday (tomorrow) to vote on the Brexit agreement, would approve the deal.
"When my colleagues in Parliament study this agreement, they will want to vote for it on Saturday and then in succeeding days," he told reporters.
But the arithmetic in the vote is not simple.
The Northern Irish party that Johnson needs to help ratify any agreement, the Democratic Unionist Party (DUP), has refused to support it, saying it is not in Northern Ireland's interests.
The head of the main opposition Labour Party, Jeremy Corbyn, said he was "unhappy" with the agreement and would vote against it. Labour has said it wants any deal to be subject to a public vote, but as yet has not indicated whether it will back any move for a second referendum on Saturday.
Johnson does not have a majority in the 650-seat Parliament, and in practice needs at least 318 votes to get a deal ratified. The DUP have 10 votes. Parliament defeated a previous deal struck by Johnson's predecessor, Theresa May, three times.
Deutsche Bank estimated there was a 55 percent chance Parliament would reject Johnson's deal, and other analysts thought similar.
Johnson appears intent on presenting Parliament with a stark choice - the deal he has struck or no deal - in the hope of securing just enough votes, including perhaps from the opposition benches, to secure a knife-edge approval.
"The PM's position is that it's new deal or no deal but no delay," said a senior British government official.
If the deal is approved, economists said Britain was likely headed for a "fairly hard" Brexit, certainly a harder one than would have been the case under May's deal.
German Chancellor Angela Merkel (photo) said one positive move with the Johnson deal was that it was clear Britain would become what the EU calls a "third country", making it essential for the EU to work rapidly on reaching a free trade agreement with it.
"There is an essential difference compared with when Theresa May was prime minister," said Merkel. "Then it was not clear how the future relations would look, whether membership of the customs union or not. Now it is quite clear."
Johnson spoke to the other EU leaders for about 30 minutes during his first - and possibly last - summit in Brussels.
In a sign of the times for the bloc, which has never yet lost a member, he is expected to skip the second day of discussions on the EU's future budget and tackling climate change.
As Britain took a step closer to leaving the EU after more than four decades, Irish Prime Minister Leo Varadkar made a case for the union.
"As the leader of a small nation, I have felt enormous solidarity from our European partners," he said, bidding farewell to Britain, "an old friend".
"The unity that we have seen in the last few years is a lesson to us for the future... something we take forward for future negotiations. Not just with the UK, but the US and China and Turkey and others."
Negotiators worked frantically this week to agree a compromise on the question of the border between EU member Ireland and the British province of Northern Ireland, the most difficult part of Brexit.
The conundrum was how to prevent the frontier becoming a backdoor into the EU's single market without erecting checkpoints that could undermine the 1998 Good Friday Agreement, which ended decades of conflict in the province.
The agreement reached will keep Northern Ireland in the UK customs area but EU tariffs will apply on goods crossing from mainland Britain to Northern Ireland if they are headed to Ireland and into the bloc's single market.
The agreement scraps the "backstop", a mechanism envisaged earlier that was designed to prevent a hard border being introduced on the island of Ireland, and would have bound at least parts of Britain to some EU rules.
However, the DUP, which supports Johnson's government, said the new text was not acceptable - a step that could spur hardline Brexiteers in his Conservative party to vote it down.
"These proposals are not, in our view, beneficial to the economic well-being of Northern Ireland," the party said.
The uncertainty over Parliament's approval means that, two weeks before Britain is due to leave the world's largest trading bloc, the possible outcomes still range from an orderly departure to a chaotic exit or even another referendum that could reverse the entire endeavour.