The British government’s highly contested plan to fly some asylum seekers to Rwanda suffered a significant setback on Thursday when one of the country’s top courts ruled against the move to deport would-be refugees before their claims are assessed.

In a judgment delivered in London, the Court of Appeal said that Rwanda was not a safe country for asylum seekers. In doing so, the judges reversed a ruling in December by the High Court, which dismissed most legal challenges to the plan.

The decision on Thursday was not unanimous, with one of the three judges taking the opposite view.

“The result is that the High Court’s decision that Rwanda was a safe third country is reversed and that unless and until the deficiencies in its asylum processes are corrected, removal of asylum seekers to Rwanda will be unlawful,” said Ian Burnett, the lord chief justice.

The decision is unlikely to be the final word in what has already been a protracted legal battle over the government’s offshoring plans, which have been fiercely criticized by activists and human rights groups. The government is expected to appeal to Britain’s Supreme Court to try to overturn the decision.

The government hopes its agreement with Rwanda, which was struck last year, will deter asylum seekers from making the dangerous crossing from France to the southern coast of England on small, often unseaworthy boats.

The political stakes are high, too, because, amid rising tension within the Conservative government over an increase in immigration, Prime Minister Rishi Sunak of Britain has promised to “stop the boats” — making his hard-line policy one of the five central objectives of his leadership.

Advocacy groups say that flying asylum seekers to Rwanda, whose human rights record has been criticized, would violate international law and would not necessarily deter those risking the perilous journey across the English Channel.

The British government has also reached a deal with the Albanian government to send asylum seekers there, an agreement that appears to have helped reduce the number of small boat crossings. So far in 2023, there have been 10,139 arrivals, according to the latest data released by the home office, compared to more than 11,300 by mid-June last year.

Advocacy groups have maintained that flying asylum seekers to Rwanda, whose human rights record has been criticized, would violate international law and might not have the intended effect of deterring migrants from risking the dangerous journey across the English Channel.

The ruling was the latest chapter in a lengthy legal battle that included a last-minute challenge grounded the first planned flight to Rwanda last June.

In December, the High Court ruled in favor of the government’s plan to send asylum seekers to Rwanda but also said that specific deportation cases should be reconsidered. Campaigners against the policy then appealed that decision, leading to the judgment on Thursday.

The continuing legal uncertainty leaves doubt as to when — or whether — the highly contentious policy would be put into action and, in particular, whether the first flight to Rwanda will take off before the next general election, which is expected in the second half of next year.

“After today’s judgment, it’s time the government abandoned its brutal Rwanda policy and any alternative proposal to shirk the U.K.’s responsibility for people seeking asylum,” said Steve Smith, the chief executive officer of Care4Calais, a refugee charity that brought an earlier legal challenge against the policy.

“Instead, they should offer safe passage to refugees in Calais as the effective and compassionate way to put smugglers out of business, end small boat crossings and save lives,” he said, referring to port city in northern France that many migrants use as a point of departure.

There was no immediate response from the government.

Under its deal with the small African nation, Britain is paying Rwanda more than £120 million, or nearly $152 million, in development funding and will also pay for the processing and integration costs for each relocated person. People granted asylum in Rwanda would not be able to return to Britain.

An economic impact assessment released by the Home Office this week, said that the gross cost of relocating each individual was estimated at £169,000.

In defending its plans, the government has cited policies implemented by Australia, which employs offshore asylum processing, and argued that such hard-line policies are the only way to destroy the business model of people smugglers.

The U.N. refugee agency and other legal experts have questioned whether the asylum agreement with Rwanda is compatible with Britain’s obligations under refugee and human rights laws.