The Court of Appeal has upheld a ruling declaring a key part of the government's asylum system is unlawful.
In June, the High Court said detaining asylum seekers and speeding through their appeals was wrong.
That decision has now been backed by senior judges who said the "Detained Fast Track" system did not take into account the complexity of claims.
The government said it was disappointed with the outcome and would be seeking further permission to appeal.
Ministers have already suspended Detained Fast Track but had told MPs they wanted to re-launch the system within weeks.
They will now seek to appeal to the Supreme Court.
The decision could have major implications for hundreds of cases where applicants for asylum have lost their case during an accelerated legal process, while being held in detention. Some 323 asylum seekers have been released from detention in the past month, 200 of whom had already had their claims rejected.
In Wednesday's ruling, Lord Dyson, the Master of the Rolls, said truncating the time available for appeals was "systemically unfair".
The Detained Fast Track system played a key role in immigration removals and could lead to someone leaving the country in about 22 days.
The system was created in 2003, and was applied to 4,300 asylum seekers in 2013.
Immigration officers could order the detention of any asylum seeker whose case they thought would result in a quick ruling.
The system was sometimes used to handle clandestine migrants, such as those entering via the English Channel ports, whom officials thought had no case for refuge.
But a string of legal challenges over the past year eroded the power after complaints that many of those being put through the system had suffered torture or had other justified cases for humanitarian protection.
'Fairness and justice'
Last month, Mr Justice Nicol ruled in the High Court that fast tracking appeals involved "structural unfairness" because claimants could not properly prepare their case, or access expert help, while in detention.
And three weeks ago, ahead of a related case, ministers suspended the entire system, telling Parliament they could not be sure that vulnerable applicants were being dealt with fairly.
Immigration minister James Brokenshire said the suspension might only last a matter of weeks - but in Wednesday's judgement the Court of Appeal ruled the time limits imposed on the appeals could be "potentially disastrous" if the decision was wrong.
"The scheme does not adequately take account of the complexity and difficulty of many asylum appeals, the gravity of the issues that are raised by them and the measure of the task that faces legal representatives in taking instructions from their clients who are in detention," said Lord Dyson.
"It seems to me that some relaxation of the time limits is necessary, but it is not for the court to prescribe what is required to remedy the problem.
"A lawful scheme must, however, properly take into account the factors to which I have referred whilst, I acknowledge, giving effect to the entirely proper aim of processing asylum appeals as quickly as possible, consistently with fairness and justice."
Jerome Phelps, director of Detention Action which brought the original claim, said: 'The Detained Fast Track is a fundamentally flawed process. The courts have repeatedly found that it is structurally unfair towards people who are seeking protection in the UK.
"Despite repeated changes, it has continued to be unlawfully unfair. Asylum-seekers and the government have a common interest in a system that is both fast and fair. We hope that the government will work with civil society to find a different approach that does not sacrifice fairness on the altar of speed."
A government spokesperson said: "We are disappointed with the outcome of this appeal. Notably the judgment recognises the government's aim of processing asylum appeals as quickly as possible. We regard fast track as an important part of our immigration system and the courts do not oppose this principle. We are seeking further permission to appeal."