Campaigners are claiming victory in their battle to stop the deportation of about 50 people to Jamaica from Britain on Tuesday, a move activists feared was reminiscent of the Windrush scandal.
The British Home Office detained the people at two centres near London’s Heathrow Airport.
It says the people, who were due to be flown out to the Caribbean on Tuesday morning, are foreign criminals.
Campaigners lost a High Court decision on Monday but the Court of Appeal later ruled against it, after a charity said some of those detained did not have working mobile phones after problems with a nearby O2 phone mast.
Detention Action said some of them did not have good access to legal advice.
Lady Justice Simler said the Home Office should not remove anyone "unless satisfied they had access to a functioning, non-O2 Sim card on or before 3 February".
Bella Sankey, director of Detention Action, said the court ruling was a victory for “access to justice, fairness and the rule of law”.
"On the basis of this order from our Court of Appeal we do not believe anyone currently detained at the Heathrow detention centres can be removed on the flight," Mr Sankey said.
"We understand that this will apply to at least 56 people."
Two men among those set to be deported were convicted of drugs offences when they were teenagers. They said they had no links to Jamaica and left the country at a young age.
One of them, Tajay Thompson, left when he was five years old with his family to come to South London.
He was convicted of possessing Class A drugs with intent to supply when he was 17 and served half of a 15-month sentence in 2015.
"It's not like I'm a rapist or a murderer," Mr Thompson told Sky News. "I made a mistake when I was 17 and it's now going to affect my whole life."
He said he had visited Jamaica only twice since, on holidays.
"I feel like I was born here," Mr Thompson said. "Jamaica is not my country."
His mother, Carline Angus, said she feared for her son’s safety.
The Guardian newspaper reported that 13 of the detainees said their lives would be at risk because of gang violence in Jamaica.
Earlier on Monday, more than 170 British MPs backed a call to halt the flight to the Caribbean, accusing the government of trying to maintain a “hostile environment”.
In a letter to Prime Minister Boris Johnson organised by opposition Labour party MP Nadia Whittome, MPs warned of the “unacceptable risk of removing anyone with a potential Windrush claim”.
In 2018 the UK Home Office was mired in scandal over the wrongful deportation of at least 83 people, many of whom were British subjects from the Caribbean who arrived in the UK as members of the so-called Windrush generation.
Named after the Empire Windrush, the ship that brought one of the first groups of West Indian migrants to Britain in 1948, they travelled to the UK legally in the 1950s and '60s.
In the scandal that erupted in 2018, many were wrongfully detained and denied legal rights, leading to the resignation of the home secretary Amber Rudd.
MPs said the government “risks repeating the mistakes of the Windrush scandal unless it cancels this flight and other like it”.
The letter calls for all deportation flights to be postponed, pending recommendations from a review of the 2018 scandal.
“The fact is that many of the individuals in question have lived in the UK since they were children," Ms Whittome wrote.
“At least 41 British children are now at risk of losing their fathers through this charter flight."
The government has defended the flight on the grounds that the deportees are criminals without British nationality.
Mr Johnson, responding to questions from MPs in Parliament, said British people would “think it right to send back foreign-national offenders”.
A Home Office spokesman said: “The planned charter flight to Jamaica is specifically for removing foreign criminals.
“Those detained for removal include people convicted of manslaughter, rape, violent crime and dealing Class A drugs."
The Home Office said it had removed more than 51,000 foreign offenders since 2010.