Boris Johnson has agreed a new Brexit deal with the EU after last-ditch talks ahead of a crucial leaders' summit in Brussels.
Negotiators worked until 2am on Thursday to strike the deal – but questions remain about whether it can gain enough support back in Westminster.
"Where there is a will, there is a deal – we have one!" Jean-Claude Juncker said in a statement on Thursday morning.
"It’s a fair and balanced agreement for the EU and the UK and it is testament to our commitment to find solutions. I recommend that European Council endorses this deal."
In his own statement Mr Johnson said: "We’ve got a great new deal that takes back control — now Parliament should get Brexit done on Saturday so we can move on to other priorities like the cost of living, the NHS, violent crime and our environment."
But the agreement is crucially understood to not have the support of DUP members of parliament, whose votes in parliament are almost certainly required for it to pass it.
“Read our statement. It hasn’t changed," a DUP source said.
Later on Thursday EU leaders will meet to discuss the accord, which will need to be signed off by member states. They will also consider whether an extension to Article 50 is required.
Mr Juncker said there would be "no need for any kind of prolongation" if the deal was passed, adding: "I have to say that I'm happy about a deal but I'm sad about Brexit."
British members of parliament are expected to discuss the agreement at an extraordinary sitting of parliament on Saturday.
Speaking at a press conference in the European Commission's Berlaymont headquarters EU chief negotiator Michel Barnier said the deal was "the result of intensive work on the part of the two negotiating teams".
"A point extremely important to prime minister Johnson and the UK was that Northern Ireland remains in the UK's customs territory. Discussions in the past few days have at times been difficult, but we have delivered, and we have delivered together," he told reporters.
Under the agreement, Northern Ireland will stay inside the UK customs territory, but UK authorities will have to collect EU tariffs for goods that are "at risk of entering the single market", Mr Barnier said. He added that the arrangement would allow the territory to "benefit from the UK's future trade policy" – a key demand of Brexiteers.
The Northern Ireland Assembly has also been given a veto on the plans – though not to the extent demanded by the DUP. After the end of the transition period, the proposals will automatically come into force for four years. After that, MLAs in the assembly will get a vote to decide whether the regime should continue. A simple majority is required to continue the vote for another four years, after which there will be another vote. In the event a "cross-community" majority of unionists and nationalists backs the proposals, the next vote will be after eight years. If MLAs reject the proposals, there will be a two year "cooling off" period before they end.
"Four years after the entry into force of the protocol the elected representatives of Northern Ireland will be able to decide by simple majority whether to continue to apply union rules in Northern Ireland or not," Mr Barnier explained. "This democratic support is a cornerstone of our newly agreed approach."
Notably, the agreement is no longer a "backstop" but instead intended as the basis for a permanent agreement between the UK and EU. Boris Johnson's plans to scrap commitments to a "level playing field" that would protect environmental, social and labour rights and keep them at the same level as the EU did not come to fruition, with the clauses remaining in the agreement.
Under the agreement, Northern Ireland will stay inside the EU's VAT regime, though UK authorities will be responsible for collecting the tax.
Taoiseach Leo Varadkar hailed the agreement, describing it as a "unique solution for Northern Ireland that respects unique history and geography".
"It's good for Ireland and Northern Ireland. No hard border. All-island and East-West economy can continue thrive. Protects single market and our place in it," he added.
Questions still remain about whether the deal can be ratified in time to hold the prime minister to his pledge to leave the EU on 31 October – and whether it can gain enough support in Westminster.
One senior EU official said: “We were told in 2018 by the UK government that the ratification process takes six months, at the beginning of 2019 we were told that it takes six weeks, and the latest is that a few days is more than enough.”
Back in London, Labour leader Jeremy Corbyn described the agreement as a "sell out" and indicated that his MPs would refuse to back it.
“From what we know, it seems the Prime Minister has negotiated an even worse deal than Theresa May’s, which was overwhelmingly rejected," he said.
“These proposals risk triggering a race to the bottom on rights and protections: putting food safety at risk, cutting environmental standards and workers’ rights, and opening up our NHS to a takeover by US private corporations.
“This sell out deal won’t bring the country together and should be rejected. The best way to get Brexit sorted is to give the people the final say in a public vote.”
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies