The three pupils, all of whom had their identities protected by the court, had spent a combined 154 school days in isolation during the 2023-24 academic year between them, according to the judge’s written ruling.

Two of the youngsters had a record of violence against fellow pupils and staff, while the third had a persistent record of poor behaviour, which included “defiance” and truancy, the judgement added.

Their parents did not challenge the principle of isolation or the school’s right to use it as a form of discipline, but had claimed the repeated extent to which it was used was unlawful.

They said it breached government guidance on school discipline, as well as the Education and Inspections Act and the pupils’ right to private life under Article 8 of the Human Rights Act.

It was claimed the youngsters had found isolation to be “unproductive, unpleasant, stressful and distressing”.

But the judge said each sanction was in line with the school’s policy and that it was expected that repeated misconduct “be met with persistent, and indeed escalating, sanctioning”.

She also said it was not “obvious” what the alternative punishment should have been.