The British government on Wednesday vowed to press on with efforts to deport illegal immigrants to Rwanda, despite a ruling from the nation’s Supreme Court that the program in its current form is unlawful – with the prime minister saying the government was prepared to potentially change U.K. legal frameworks and international obligations to make it happen.

The U.K.’s Conservative government unveiled the policy in 2022, which would see migrants removed to Rwanda as part of a “safe third country” agreement and allowed to claim asylum there. The ruling Conservative Party has struggled for years to deliver on repeated promises to stop the flow of illegal immigrants, who have been arriving primarily on small boats from France. Sunak has promised Britons that he will “stop the boats.”

Government officials had said the program would disincentivize migration to the U.K. if migrants knew they would be deported instead. But the Rwanda plan was immediately hit by a legal challenge just as the first plane was due to depart and so far not a single migrant has been deported under the program. On Wednesday, the high court ruled that the migrants were at “real risk of ill-treatment” if removed.

FORMER BRITISH HOME SECRETARY SUELLA BRAVERMAN ACCUSES PM SUNAK OF BETRAYING PROMISES

The judges concluded “there is a real risk that asylum claims will not be determined properly, and that asylum-seekers will in consequence be at risk of being returned directly or indirectly to their country of origin.”

“In that event, genuine refugees will face a real risk of ill-treatment,” they said.

Prime Minister Rishi Sunak noted that the court had not objected fundamentally to the concept of a safe third country – but that it had instead found Rwanda could not be classed as one in its current state.

“They confirmed that the principle of removing asylum seekers to a safe third country is lawful,” Sunak told the House of Commons. “There are further elements they want additional certainty on and noted that changes can be delivered in the future to address those issues.”

He said the government has been working on a new treaty with Rwanda, adding that “if necessary, I am prepared to revisit our domestic legal frameworks.”

“Let me assure the House, my commitment to stopping the boats is unwavering,” he said.

FORMER UK PRIME MINISTER DAVID CAMERON MAKES SURPRISE RETURN 

The ruling comes at a politically perilous time for Sunak, who is also facing pressure from members within his own party from the right for allegedly not being tough enough on illegal immigration.

Sunak removed Home Secretary Suella Braverman – the most high-profile immigration hardliner in the Cabinet – this week as part of a reshuffle that also saw former Prime Minister David Cameron return to government as foreign secretary.

Braverman tore into Sunak in a letter to his office on Tuesday, in which she accused him of having failed to deliver on key promises, including those made on illegal immigration. She accused him of not making adequate preparations, including reconsidering U.K. commitments to the European Convention on Human Rights and similar obligations. 

“If we lose in the Supreme Court, an outcome that I have consistently argued we must be prepared for, you will have wasted a year and an Act of Parliament, only to arrive back at square one. Worse than this, your magical thinking – believing that you can will your way through this without upsetting polite opinion – has meant you have failed to prepare any sort of credible ‘Plan B,'” she said.

Polls have shown Sunak’s Conservative Party trailing significantly to the opposition Labor Party if elections were held now. Labor leader Keir Starmer also hit Sunak on Wednesday and said the prime minister has been left “totally exposed” by the ruling.

“The central pillar of his government has crumbled beneath him,” Starmer told Sunak to cheers from his side of the Commons.

The Associated Press contributed to this report.