The Government has lost a challenge against a ruling that an unaccompanied asylum seeker who arrived in the UK in the back of a lorry was entitled to damages after his claim to be ''a child'' under 18 was disbelieved by an immigration officer.
The teenager from Sudan was deprived of his liberty because the officer said he ''reasonably believed'' he was over 18 and not a child exempt from detention.
Last year, a judge at the High Court in London ruled that the Home Office policy of relying on the ''reasonable belief'' of immigration officers was legally flawed and declared that age assessments in unaccompanied minor cases must be determined as ''an issue of objective fact''.
In a ruling with wide ramifications for unaccompanied minor cases, Sir Stephen Silber declared that the claimant - previously referred to as AA, but now named as Abdul-Muttalab Ali - was entitled to damages for the whole of his detention period.
Home Office lawyers had described the case as being ''profoundly troubling for the efficient running of a fair immigration system'', but the Refugee Council said the High Court judgment sent out a "clear message to the Home Office that its current policy is both unlawful and indefensible".
Three Court of Appeal judges have now rejected a challenge by the Home Secretary against Sir Stephen's ruling.
Announcing the court's decision on Thursday, Lord Justice Davis said the case "has a wider importance for other cases".
Lord Justice Davis, who heard the appeal with Lord Justice Underhill and Lord Justice Lindblom last month, declared that the High Court judge had "reached the right conclusion".
He said: "If the result which I reach in this case is unwelcome to the present Government then its remedy is to amend the statutory provisions."
The teenager's lawyers later described the Court of Appeal's judgment as "landmark", and said the judges had ruled that "the Government have been unlawfully detaining vulnerable unaccompanied asylum seeking children since 2015".
They said the case concerned "a vulnerable 16-year-old child" - who arrived in the UK to claim asylum in 2014 - and who was "detained by immigration officials on the basis that they assessed him, on appearance alone, to be significantly older than 18".
Law firm Bhatia Best said the appeal court ruling has "far reaching implications for how the Government must treat vulnerable unaccompanied children and the circumstances when a power can be exercised to detain a putative child".
Rebecca Hilsenrath, chief executive of the Equality and Human Rights Commission, which intervened in the case, said: "A culture of disbelief in our asylum system is putting children at risk.
"Children claiming asylum must be treated as children until proven otherwise, and must not be detained or held with adults.
"Britain has a long history of helping refugees from around the world, but this is put at risk if we cannot protect those who are most vulnerable.
"We are glad the court has agreed with us that asylum seekers who are under the age of 18 should not be detained even when immigration officials believe they are adults. This must be confirmed through an independent age assessment."
Refugee Council policy manager Judith Dennis said: "This ruling sends an unequivocal message to the Government: allowing officials to randomly guess children's ages and then throw them behind bars breaks the law.
"The Government must now recognise that when children's lives are in the balance it's simply not good enough for immigration officials to decide a child's future on the basis of a cursory glance.
"Now is the time for the Home Office to prove it's serious about children's safety by changing its policy and leaving decisions on people's ages to the experts."