LONDON - Britain’s Supreme Court ruled Wednesday that the government’s contentious plan to send some migrants on a one-way trip to Rwanda is illegal, striking a major blow to a key policy of Prime Minister Rishi Sunak's government that has drawn international attention and criticism.

Five justices on the country’s top court ruled unanimously that asylum-seekers sent to Rwanda would be “at real risk of ill-treatment” because they could be returned to the home countries they'd fled.

Sunak, who has pledged to stop migrants reaching Britain in small boats across the English Channel, said the ruling “was not the outcome we wanted.”

But he added, “we have spent the last few months planning for all eventualities and we remain completely committed to stopping the boats.”

Refugee and human rights groups welcomed the decision. Charity ActionAid U.K. called it a vindication of “British values of compassion and dignity." Amnesty International urged he British government to “draw a line under a disgraceful chapter in the U.K.’s political history.”

Britain and Rwanda signed a deal in April 2022 to send some migrants who arrive in the U.K. as stowaways or in boats to the East African country, where their asylum claims would be processed and, if successful, they would stay.

Britain’s government argued that the Rwanda policy would deter people from risking their lives crossing one of the world’s busiest shipping lanes, and would break the business model of people-smuggling gangs. Opposition politicians, refugee groups and human rights organizations said the plan was unethical and unworkable.

No one has yet been sent to the country as the plan was challenged in the courts.

Reading the unanimous decision, President of the Supreme Court Robert Reed said Rwanda could not be relied on to keep its promises not to mistreat asylum-seekers sent from Britain.