Under the plan, Britain intended to send tens of thousands of asylum seekers who arrived on its shores without permission to the East African country in a bid to deter migrants crossing the Channel from Europe in small boats.
But the top court on Wednesday unanimously rejected the government's appeal against an earlier ruling that migrants could not be sent to Rwanda because it could not be considered a safe third country.
President Robert Reed said the five judges involved agreed there were "substantial grounds for believing that asylum seekers sent to Rwanda would be at real risk of refoulement", meaning being sent back to their country of origin where they could be at risk of ill-treatment.
The Rwanda scheme was the central plank of Sunak's immigration policy as he prepares to face an election next year, amid concern among some voters about the numbers of asylum seekers arriving in small boats.
Sunak, whose Conservatives are trailing by about 20 points in opinion polls, had made a promise to "stop the boats", one of the five key pledges of his premiership.
This year more than 27,000 people have arrived on the southern English coast without permission after a record 45,755 were detected in 2022.
The ruling had taken on even greater political significance in recent days after Sunak sacked home secretary Suella Braverman, a popular figure on his party's right wing whose remit included dealing with immigration.
She launched a scathing attack on Sunak on Tuesday, saying he had broken promises on tackling immigration and betrayed the British people.
Critics, ranging from opposition MPs as well as some in his own Conservative Party to church leaders and the United Nations refugee agency, had argued the policy was flawed, immoral and simply would not work.
The Rwanda policy was drawn up by former prime minister Boris Johnson in an initial Stg140 million ($A268 million) deal.
While the court said it was unlawful, Reed left open the chance the scheme could be resurrected, saying "the changes needed to eliminate the risk of refoulement may be delivered in the future, but they have not been shown to be in place now".
With many MPs in Sunak's Conservative Party saying Britain should consider leaving the European Convention on Human Rights over the issue, Reed said their decision was based on a number of laws and treaties, and not the convention alone.
After the ruling, a Rwandan government spokesperson said it took issue with the conclusion that Rwanda was not a safe third country.