Segregating boys from girls in a state-funded Muslim secondary school classroom is unlawful sex discrimination, a court has found.

Three Court of Appeal judges in London on Friday overturned last year’s finding by a High Court judge that Ofsted inspectors were wrong to penalise the mixed-sex Al-Hijrah school in Birmingham on the basis of an “erroneous” view that segregation amounted to unlawful discrimination.

In a landmark case, the school had originally challenged its critical Ofsted report, which found dividing the pupils by their sex left them entirely “unprepared for life in modern Britain.”

The school has complete segregation of boys and girls from nine to 16 for all lessons, breaks, school clubs and trips. For religious reasons the voluntary-aided institution, which has pupils aged between four and 16, believes that separation of the sexes from year five onwards is obligatory.

Al-Hijrah, which became state-funded in 2001, was put into special measures in 2016 after pro-rape texts were found in the institution’s library and a child died from an allergic reaction. As Breitbart London reported, an Ofsted inspector also identified bullying, said the playground was chaotic, teaching was poor, pupils were not safe and some staff did not know what to do in medical emergencies.

The school was given an “inadequate” judgment, the lowest ranking. The school attempted to suppress the report’s findings with funding from Birmingham city council.

The new judgement means Ofsted will be able to mark down Islamic and other faith schools in future for segregating pupils.

Government lawyers had said there were a “number of schools” that would have to stop segregating, or split into single sex schools if Ofsted won the case.

According to the Daily Mail, Helen Mountfield QC, representing the watchdog, had said segregating pupils in a mixed sex school was against the Equality Act 2010.

She previously told the court: “If boys and girls in a school which is registered as a mixed-sex school lose the opportunity to work and socialise confidently with members of the opposite sex, as Ofsted says they should do, they will go into the world unprepared for life in modern Britain where they are expected to be able to work and socialise in mixed-sex environments.”