Image copyright Getty Images Image caption Feltham houses young male offenders aged between 15 and 18

A 16-year-old boy's human rights were breached by his being kept in solitary confinement for 23-and-a-half hours a day, a judge has ruled.

The High Court said the boy, who is referred to as AB, was unlawfully denied access to education and the ability to mix with other inmates.

But it rejected claims his treatment at Feltham Young Offenders Institution was "inhuman and degrading".

The Ministry of Justice said it would "carefully" consider the findings.

The MoJ was contesting the legal challenge by AB, who has "significant" mental health problems. He was detained in December and is due to be released in later this month.

Feltham, in south-west London, provides specialist custodial places for boys aged 15-18.

On Tuesday, the judge ruled that AB's Article 8 rights - the right to private and family life - were breached, but Mr Justice Ouseley rejected claims his treatment amounted to a breach of the human rights laws which prohibit torture and inhuman or degrading treatment or punishment.

Inside Feltham: 'I saw people's heads stamped on'

The Howard League for Penal Reform, which took forward the case on AB's behalf, said the court had "declared this boy's isolation for certain periods and the denial of adequate education unlawful because it was against prison rules".

But chief executive Frances Crook said the group would appeal against the "disappointing" part of the judgement.

'Justified segregation'

Rebecca Hilsenrath, chief executive of the Equality and Human Rights Commission, said the 16-year-old's confinement was "simply the wrong thing to do".

She said: "To lock up a young child with special educational needs for over 23 hours a day, with little to no education or exercise, is an attack on their rights.

"Isolation of this kind has been widely criticised by experts in the field, both in the UK and internationally."

The MoJ, however, insisted that "proportionate and justified segregation" was essential to managing inmates if they pose a risk to staff and other prisoners, and it was pleased the judge had found in its favour on that point.

The spokesperson added: "The safety and welfare of young people held in custody is our highest priority."

The court was told by a QC for the Justice Secretary that the boy had a history of assaulting prison staff and making "racist taunts", and "poses a very real risk to the good order or discipline" at Feltham.

During a recent inspection, separate to the case, Feltham was found to run an "ineffective" regime for managing bad behaviour.

The HM Inspectorate of Prisons said about 40% of boys were locked up during the school day while 30% were allowed out of their cells for only two hours each day.

Nevertheless, inspectors praised staff for their "impressive" healthcare and mental health provisions.