A teenage boy with "significant" mental health problems has been held in solitary confinement for four-and-a-half months, a court has heard.
The boy, who is 16 and referred to as AB, was detained alone in his cell at Feltham Young Offenders Institution in London for 23-and-a-half hours a day.
Lawyers for his mother claim the "inhuman and degrading" conditions breach the Human Rights Act.
The Justice Secretary, Liz Truss, is contesting the case.
The High Court was told that Ms Truss had "conceded" that AB's placement in solitary conditions had breached his right to a private life and was unlawful because prison rules weren't followed.
"The real dispute relates to Article 3," said Dan Squires QC, for AB's mother, who also claims that he has been denied the statutory minimum of 15 hours' education per week.
Mr Squires said AB was placed on "single unlock" when he arrived at Feltham last December, meaning that he was allowed out for only 30 minutes each day to shower, exercise, make a phone call and take medication. He was given no education.
Since February, the boy has been permitted out of his cell for slightly longer periods, mainly to attend classes, but still spends at least 22 hours alone in his cell.
"All he has to do is to watch television...or lie on his bed," said Mr Squires.
The court heard the boy had experienced "emotional and physical abuse and serious trauma" when he was younger.
According to papers submitted by his legal team, he has been diagnosed with post-traumatic stress disorder anxiety, hyper-vigilance, hyper-arousal and attention deficit hyperactivity disorder, for which he requires a "high dose" of medication.
He is due to be released in July.
The documents say AB has been known to police since he was 10, and has been convicted of a range of offences.
According to the legal documents the boy was placed in solitary confinement because of his behaviour at another young offender institution on a previous sentence, and continued after he shouted abuse at staff and other children.
But Mr Squires said it was "common practice" at Feltham to hold inmates with "challenging behaviour" in solitary confinement, citing an inspection report which found that 25% of boys there were locked alone in their cells for 23 hours a day.
The judicial review action has been brought on behalf of the child by the Howard League for Penal Reform.
The charity's chief executive Frances Crook said: "This is a widespread problem and it is getting worse.
"In just the last week, several more children, held in prisons across the country, have asked the Howard League for help because they are in almost total isolation."
The hearing will continue on Wednesday. The judgement is expected to be reserved.