British Prime Minister Theresa May has secured approval from her Cabinet for her draft Brexit deal, but she now faces some tough new challenges.
The agreement was reached after an "impassioned" five-hour meeting with MPs. She said the draft withdrawal agreement was "the best that could be negotiated".
The 585-page agreement was published with a shorter political statement on ambitions for a future relationship. EU leaders will now get their say, before a vote in the House of Commons.
Ms May still faces an uphill task getting her deal through the divided House of Commons, where her Conservative Party doesn't have a majority and rebel MPs are expected to cross the floor to vote against the deal.
News of the deal has already sparked a furious response in the UK.
Nigel Farage, who headed the pro-Brexit campaign, savaged the agreement as the "worst deal in history".
"Any cabinet member who is a genuine Brexiteer must now resign or never be trusted again, this is the worst deal in history," he said.
Scotland's first minister Nicola Sturgeon said the draft deal was the "worst of both worlds".
Her party has pledged to oppose the proposals.
Others have backed the deal, including Welsh Tory MP Stephen Crabb. "Brexit was always going to be a long and ugly process," he said.
"There is no shiny perfect Brexit deal available — only difficult choices and compromises.
"For a divided nation, the deal the Cabinet has endorsed tonight looks responsible and reasonable."
NO BREXIT AN OPTION?
Commentators have noticed a key line used by Ms May in a doorstep interview after the vote.
She referenced a choice between "this deal, no deal and no Brexit".
Labour MP for Tottenham David Lammy said Ms May had made a "huge concession", adding that this meant, "Brexit is not inevitable.
"We do not have to choose between her atrocious deal and no deal at all. We can still remain in the EU."
FIERY QUESTION TIME
Mrs May endured a fiery Question Time on Wednesday, when she was quizzed about her Brexit plan and battled to convince her Cabinet to back it.
Ministers visited Downing Street, where the British Prime Minister had called a special Cabinet meeting to sell the draft agreement she and the leaders of the European Union have come up with.
There is talk she could be forced to quit if a number of senior figures quit in response.
She faces an uphill task in getting it green-lit in the divided House of Commons, where her Conservative Party doesn't have a majority and rebel MPs are expected to cross the floor to vote against the deal.
The BBC reported the prime minister would try to head off the threat of resignations by telling her ministers that while the agreement was not perfect, it was as good as it could be.
Mrs May had been expected to address media about 5pm local time (4am AEDT), but the meeting overran by as much as an hour.
"Everything is very fragile. Let's remember where we were a few weeks ago when we thought we had a deal and we all know what happened," one diplomat told reporters.
"We are still waiting for signals from London. Waiting for the green light. The time schedule is still very tight for EU summit. We need consent from UK."
In a tense Question Time before the Cabinet showdown, MPs — both friend and foe — attacked the plan, and Mrs May's handling of the negotiations.
Senior Conservative MP Peter Bone, who is pro-Brexit, said she was "not delivering the Brexit people voted for" and told her: "Today you will lose the support of many Conservative MPs and millions of voters across the country."
Jacob Rees-Mogg, the leader of the pro-hard Brexit European Research Group of Tory MPs, said the reported deal represented a betrayal of Mrs May's promise to maintain the integrity of the United Kingdom.
"White flags have gone up all over Whitehall. It is a betrayal of the Union," he said.
Labour leader Jeremy Corbyn told parliament "this Government spent two years negotiating a bad deal" and that the prime minister was asking MPs to choose between a "half baked deal and no deal".
Mr Corbyn said the PM's deal would result in a "catastrophic series of consequences" and "neither of these options is acceptable".
But Mrs May hit back and declared the Government "will not renege on the decision of the British people" as she insisted that "we will take back control of our money, laws and borders".
The main obstacle in negotiations has been how to ensure there are no customs posts or other checks along the border between Northern Ireland, which is part of the UK, and Ireland, which is an EU country.
Britain and the EU agree there must be no barriers that could disrupt businesses and residents on either side of the border and undermine Northern Ireland's hard-won peace process — but they have differed on how to achieve that.
The controversial "Irish backstop" plan is the element of Mrs May's deal that is most likely to cause fury among MPs. The mechanism is designed to ensure there is never a hard border between Northern Ireland and the Republic.
Britain and the EU hope to agree a technological solution to the border problem during trade talks over the next two years.
The backstop is a legally binding arrangement which keeps the border open even if those efforts fail.
Leaked details of Mrs May's deal suggest that it will keep Britain tied to the EU customs union until an alternative solution is found.
The whole UK would continue to follow European rules on customs — and Northern Ireland would stay tied to EU regulations even more closely.
That is likely to concern many in the party as it means Northern Ireland would be treated differently than the rest of the UK — but the backstop would not involve checks on goods travelling between Britain and Northern Ireland.
The UK has been denied the right to bring the backstop to an end unilaterally. Instead, an independent panel would rule on whether or not talks have broken down, and end the backstop arrangement if so.
Brexiteers in the government are worried that the EU intends to keep the UK in the customs union permanently, using the backstop as cover for that.
All this is further complicated by the fact Mrs May relies on Northern Ireland's Democratic Unionist Party to prop her administration up — a fact not lost on the DUP leader, Arlene Foster, who retweeted this: "Politics may be the art of the possible, but it is also the science of the mathematics of votes."