The long and winding road taking the United Kingdom out of the European Union with a negotiated divorce deal on Oct 31 traversed some bumpy terrain this week. But it appeared to be back on track on Thursday morning when British Prime Minister Boris Johnson tweeted: "We've got a great new deal that takes back control."
His negotiators were sitting across from their EU counterparts around the clock this week, seeking a deal for a tariff-free trading relationship, after the separation approved in a UK referendum in 2016.
But they had been stuck on border and customs arrangements for Ireland, where all sides want to avoid re-establishing a post-Brexit hard border between Northern Ireland, which, as part of the UK, would leave the EU, and the Republic of Ireland, which is a member of the EU.
The border was a flashpoint in the past for sectarian violence, and a lack of border infrastructure is demanded by the Good Friday Agreement, which has ensured relative peace in the region for 20 years.
The proposed deal and its solutions to the Irish border problem now need the approval of both the European Parliament and the British Parliament.
EU leaders will consider it at their summit on Thursday and Friday, and British lawmakers will give their views at a special Saturday session of Parliament.
European Commission President Jean-Claude Juncker says the deal is a "fair and balanced agreement", and he has urged the European Parliament to support it.
But its approval by the British Parliament is far from assured.
The small yet influential Democratic Unionist Party, based in Northern Ireland, which has 10 seats in the 650-member British Parliament, said on Thursday it will not support the deal "as things stand", citing problems with mechanisms to avoid the Irish hard border.
The DUP's leader and its deputy, Arlene Foster and Nigel Dodds, issued a joint statement on Thursday in which they said, "As things stand, we could not support what is being suggested on customs and consent issues, and there is a lack of clarity on VAT", the value-added tax.
"We will continue to work with the government to try and get a sensible deal that works for Northern Ireland and protects the economic and constitutional integrity of the United Kingdom," they wrote.
The DUP's opinion is crucial because many MPs in Johnson's ruling Conservative Party plan to vote in line with its wishes.
Jeremy Corbyn, leader of the opposition Labour Party, also criticized the proposed deal, saying it looks "even worse" than the previous deal negotiated by former prime minister Theresa May, which was rejected three times by Parliament.
"This sell-out deal won't bring the country together and should be rejected," he said. "The best way to get Brexit sorted is to give the people the final say in a public vote."
If Johnson fails to get Parliament to support the deal on Saturday, he will be compelled to ask the EU for an extension of the exit date, from Oct 31 to Jan 31, something he said he would "rather be dead in a ditch" than do. However, the Benn Act, which won cross-party support in the House of Commons, requires him to do so.
The BBC's Europe editor, Katya Adler, said EU leaders were expected to give their opinion of the deal by the close of business on Friday.