A refugee boy was sent to an adult New Zealand prison when he was aged only 15 after a mix-up over his birth date in the courts.
Now that mistake has been deemed a miscarriage of justice.
The boy's aunt, who accompanied him to New Zealand from a war-torn country, took papers to the jail to show staff he was underage but "nobody listened", according to the High Court decision released on Friday.
The boy was sent to prison for 11 months - an outcome prohibited by legislation because of his age.
The boy's case, which dates back 23 years, was the first referral back to the courts from the Criminal Cases Review Commission (CCRC), which was set up four years ago to investigate possible miscarriages of justice.
It is also the first to produce a result.
The boy was not identified in the decision, where he is named only as "G", nor is his country of origin.
The place he was living in New Zealand was not specified, but the decision has been issued by the Napier registry of the High Court.
G was convicted in the district court in 2001 on a raft of charges, the most serious of which was a male assault on a female.
Lesser charges included assaulting and resisting a constable, intentional damage, driving with excess breath alcohol, and unlawfully getting into a motor vehicle.
He pleaded guilty to all the charges except getting into a motor vehicle, for which he was found guilty after a defended hearing.
He did not deny he was guilty of the historic offending in his application to the CCRC.
Documents before the court in 2001 gave his date of birth as 8 April, 1984, suggesting he was 17 when he came before the district court.
The High Court has now found his actual date of birth was 8 April, 1986 - the date recorded in a Certificate of Identity issued in 1993 and recorded on his certificate of New Zealand citizenship, issued in 1999.
Had the police realised G's true date of birth in 2001, he would have been dealt with under the then Children, Young Persons and their Families Act 1989.
A family group conference would have been called, a youth justice coordinator would have been involved, and the most serious punishment available would have been three months in a social welfare institution, followed by six months of supervision.
The decision said there was no suggestion his offending was serious enough to require him to be sent to the district court for sentencing.
"It is ... clear that there were a number of errors in the way the appellant was dealt with and they were significant," said the decision issued by Justice Susan Thomas.
"He should not have been convicted but rather he likely would have been admonished and ordered to reside for, at most, three months in a welfare institution."
Justice Thomas said G had "unique vulnerabilities".
The CCRC had told her he was a refugee who had been in the country for only eight years, and he had left formal education at the age of 13 with "limited capacity to read, write and comprehend the English language".
Justice Thomas set aside G's convictions. The sentence was quashed and it was "simply too late" to substitute any other order, she said.
The decision did not address any issues of possible compensation or redress.
Two other cases referred by the CCRC are currently before the courts.
One alleges police misconduct in the case of a man convicted of two indecency charges in 2015.
The CCRC investigation into that case found information about the defendant's identification was "intentionally removed" from a police report intended for the prosecution, and therefore the court.
The other is that of Michael October, now known as Mikaere Oketopa, who was convicted of the 1994 rape and murder of Anne-Maree Ellens.
In that case, the CCRC questioned the integrity of the police investigation and said that Oketopa's confessions were likely to be false.
The CCRC, also known as Te Kāhui Tātari Ture, has received 423 applications to have cases reviewed since it began work in 2020 - an average of 10 a month.
About 160 cases have not been taken up, usually because they are deemed not to be in the interests of justice, or other appeal processes are still available.
Almost 190 cases of the total applications have involved convictions for sexual offending, but 67 were for murder or manslaughter.
- This story was originally appeared in the New Zealand Herald.