The UK Supreme Court ruled on Wednesday that a Brexit protocol between Brussels and London is lawful, blocking a bid to scrap the controversial arrangement which governs trade in Northern Ireland.
The protocol, which keeps Northern Ireland in the European single market and customs union, has proved deeply unpopular with Northern Ireland's pro-UK unionist politicians.
They argue it casts Northern Ireland adrift from the rest of the United Kingdom and makes a united Ireland more likely.
Unionists and a cohort of high-profile Brexit supporters launched a legal challenge, arguing in a hearing last year that the legislation was incompatible with the 1998 Good Friday Belfast Agreement, which ended three decades of violence over British rule in the province.
They also sought to scrap the protocol on the grounds it was incompatible with the 1800 Act of Union which merged the kingdoms of Britain and Ireland.
But a panel of five Supreme Court judges on Wednesday "unanimously dismissed the appeals" on all grounds argued by the claimants.
Northern Ireland has been without a devolved government at the parliament in Stormont after the pro-UK Democratic Unionist Party (DUP) walked out, mainly in protest at the protocol.
The DUP wants the deal overhauled or scrapped entirely.
Responding to Wednesday's ruling, DUP leader Jeffrey Donaldson said the case had highlighted his party's problems with the protocol, adding that it was "an existential threat to the future of Northern Ireland's place within the Union."
"The checks on the Irish Sea border are the symptom of the underlying problem, namely, that Northern Ireland is subject to a different set of laws imposed upon us by a foreign entity without any say or vote by any elected representative of the people of Northern Ireland," he added.
Britain's top diplomat said last month that talks with the European Union had led to improvements in a row over the protocol's implementation.
"The conversation is happening in good faith, very discreetly and that discretion I think has helped us make real improvements," Foreign Secretary James Cleverly said during a visit to Washington, which is also taking a keen interest in the issue.