A judge at the High Court in Belfast on Monday ruled that a UK law allowing asylum-seekers to be deported to Rwanda should not apply to Northern Ireland on human rights grounds.
Political parties in the British-run province, which, like Scotland, has a separate legal system to England and Wales, said the judgement made the controversial Rwanda scheme unworkable.
But UK Prime Minister Rishi Sunak vowed to press ahead, saying it "changes nothing" about the government's plans to deport asylum seekers to Rwanda from as early as July.
"Nothing will distract us from that or delivering to the timetable I set out," he said, announcing an appeal.
"We must start the flights to stop the boats."
There have already been a spate of legal challenges to the UK government's efforts to cut record levels of irregular migration, particularly from "small boats" crossing the Channel from northern France.
In November last year, the UK Supreme Court ruled that the deportation plan was illegal under international law.
But Sunak pushed through legislation recently in parliament that deems Rwanda a safe country, allowing flights to go ahead and decision-makers to disregard aspects of human rights law.
In Belfast, judge Michael Humphreys upheld challenges to the legal powers allowing asylum-seekers to be detained and removed to the African country.
The Northern Ireland Human Rights Commission argued that the Illegal Migration Act breaches the UK's domestic and international obligations under a deal signed by London and the European Union governing post-Brexit arrangements in Northern Ireland.
That deal -- the Windsor Framework -- guarantees there would be no reduction of rights safeguarded by Northern Ireland's 1998 Belfast/Good Friday Agreement that ended decades of sectarian conflict, even if that meant that the British province's laws differed from the rest of the UK.
Like Scotland, Northern Ireland has its own separate, but similar, legal system to that in England and Wales.
The judge found that several parts of the Illegal Migration Act reduced the rights of asylum-seekers in Northern Ireland under the terms of the peace accord.
The case brought against the UK also alleged there were violations of a series of rights protected by the European Convention on Human Rights (ECHR), to which London remains a signatory.
Humphreys ruled that sections of the law that were subject to legal challenges should be "disapplied" in the province.
Stay informed. Subscribe to our newsletter
'Unworkable'
Human rights lawyer Sinead Marmion, who represented a challenge to the law from a 16-year-old boy from Iran who travelled to the UK alone in a bid to claim asylum, said that it sent a "clear message" to the government.
"Not only will asylum seekers be welcome in Northern Ireland, but they will also be legally protected," she added.
Marmion said the ruling presents "a huge obstacle" to the implementation of the Rwanda scheme in Northern Ireland "as it's been found to be incompatible with the Windsor Framework".
Northern Ireland's main pro-UK unionist party said that despite the ruling the "government must ensure immigration policy applies equally across the UK".
The ruling "blow(s) the government's irrational claims that the Rwanda scheme could extend equally to Northern Ireland completely out of the water," said interim party leader Gavin Robinson.
The largest pro-Irish unity party Sinn Fein said in a statement that the judgement "proves that the British government's Illegal Migration Act is unworkable and not compliant with human rights".
London must "ensure there is no diminution of rights as promised in previous agreements", it added.
Sunak said the Belfast/Good Friday Agreement should not be "expanded to cover issues like illegal migration".
Monday's ruling comes as a row has escalated between Ireland and London over the return of asylum seekers from the EU member to the UK.
Dublin said this month that most asylum-seekers arriving in Ireland are entering the country from Northern Ireland, and said it will enact emergency laws to deport migrants back to the UK.