London CNN  — 

Against the odds and at the last minute, the United Kingdom and the European Union struck a new Brexit deal on Thursday, though the deal faces an uphill battle to get approved by Britain’s Parliament this weekend.

Speaking at a joint news conference with European Commission President Jean-Claude Juncker in Brussels, UK Prime Minister Boris Johnson told reporters that the new withdrawal agreement “represents a very good deal for both the EU and UK” and that he hoped UK lawmakers would “come together to get Brexit done, to get this excellent deal over the line.”

Shortly after the announcement in Brussels, Johnson suffered a significant blow when his Northern Irish allies said they would not vote for the deal when it is put to the House of Commons on Saturday.

Negotiators from the EU and the UK hammered out the deal just before the start of a meeting of European leaders, some of whom expressed regret about the UK leaving the bloc. Speaking at the sidelines of the summit, Irish Prime Minister Leo Varadkar described Brexit as like “an old friend that’s going on an adventure without us.”

“We really hope it works out for them (the UK) but I think there will always be a place at the table for them if they ever choose to come back,” he said. That sentiment was echoed by the EU Council President Donald Tusk, who said he felt “sadness” about the UK leaving the union.

Parliament’s agreement is a key step in the ratification process. Without the backing of Northern Ireland’s Democratic Unionist Party (DUP), which announced Thursday that it could not support the deal, the pathway to a majority in Parliament narrows significantly.

“We have been consistent that we will only ever consider supporting arrangements that are in Northern Ireland’s long-term economic and constitutional interests and protect the integrity of the Union. These proposals are not, in our view, beneficial to the economic well-being of Northern Ireland and they undermine the integrity of the Union,” the DUP said in a statement.

The deal

EU chief negotiator Michel Barnier said in a news conference in Brussels that the new text provides “legal certainty in every area where Brexit, like any separation, creates uncertainty.”

He said Northern Ireland would remain aligned to a “limited” set of EU rules related to goods, that it will remain in the UK’s customs territory – but also the entry point into the EU’s single market – and the Northern Ireland assembly will be given a vote on whether to continue to apply EU rules in the region or not every four years.

But the deal also means that the customs border between the UK and EU will be policed at a de facto border between Northern Ireland and the rest of the UK, even though Northern Ireland itself will stay in a customs union with the rest of the UK.

When goods deemed at risk of ending up in the rest of the EU get into Northern Ireland from the rest of the UK, businesses will have to pay duties on them.

That means that if that good then makes it across the border into Ireland, the duty will have been paid. If the business sells the good in Norther Ireland, it will then be able to apply for a refund.

The solution is a major concession by Johnson, because it creates a de facto border in the Irish sea. It is also the reason why the DUP said it would not vote for it.

Barnier added that the proposal also covers the transition period, which will run until the end of 2020 – with the possibility to extend.

Johnson tweeted that since Northern Ireland will now remain part of the UK’s customs territory, it means the “anti-democratic backstop has been abolished,” referring to an unpopular part of his predecessor’s Brexit deal that was voted down by Parliament three times.

The backstop was an insurance policy in designed to avoid a so-called “hard border” between Ireland and Northern Ireland if no other solution was found by the end of the transition period in 2022. It envisaged that the whole of the UK would remain tied to the EU’s customs union until a trade deal was concluded between the two sides.

By moving the customs checks to the Irish sea, the new deal makes the backstop redundant, unless the Northern Ireland assembly votes against the arrangement.

However, if that happens, it doesn’t mean the rules will automatically stop applying. Instead, a two-year cooling-off period will kick in, during which the two sides will need to negotiate a new backstop.

UK opposition parties reject Johnson’s deal

It’s not just the DUP that’s opposing the deal.

After the announcement, the UK’s two main opposition parties also said they would reject the Brexit deal – throwing another wrench in the works for the Prime Minister.

Labour’s Jeremy Corbyn, who leads the biggest opposition group in the House of Commons, said in a statement that Johnson’s agreement was worse than what was previously agreed by May.

“This sell-out deal won’t bring the country together and should be rejected,” Corbyn added. “The best way to get Brexit sorted is to give the people the final say in a public vote.”

The Scottish National Party and the Liberal Democrats have also opposed the deal.

The series of rejections means in order for Johnson to get the deal approved by Parliament, he’ll need the support of all of his Conservative MPs, plus the 21 lawmakers he expelled after they defied him in an effort to prevent a no-deal Brexit, plus some members of the opposition.

Most estimates suggest that there are between five and 20 Labour MPs who might support a Brexit deal in defiance of their leader – making things very tight for Johnson.

If the Prime Minister can’t get parliamentary support for his plan by Saturday, he is legally obliged to write to the EU requesting a Brexit extension until January 31, 2020. He has until October 31 – just 14 days – until Britain is due to exit the bloc.

CNN’s Sarah Dean, Milena Veselinovic, Katie Polglase and Sheena McKenzie contributed reporting.