Ofsted is set to appeal a High Court ruling that gender segregation by an Islamic state school is not discriminatory.

Considering the case of a school inspected by Ofsted, which is referred to only as X, the High Court concluded that "it is unhelpful to say that segregation on the ground of sex is inherently discriminatory."

The court ruled that while "less favourable treatment on the ground of a protected characteristic is inherently discriminatory" without "proof of less favourable treatment" of female students there "is no discrimination at all".

Ofsted had argued that the school was acting unlawfully by making "parallel arrangements" within the same site for pupils based on their gender.

The school was described as "applying a regime of 'complete segregation' for all lessons, breaks, school clubs and trips."

But the judge said that Ofsted's "argument would only be well-founded if it could be established that faith schools in general, and Islamic schools in particular, segregate the sexes because they regard the female gender as inferior, and/or that girls should be separately prepared for a lesser role in society."

There is "no evidence in this case that segregation in a mixed school, still less segregation in an Islamic school, has a greater impact on female pupils".

Ofsted chief Sir Michael Wilshaw has said he will appeal the judge's conclusions on gender segregation because it was not in the "best educational interests" of children to segregate them.

The school was trying to prevent publication of a very critical Ofsted report, and after the judge's finding that Ofsted's criticism of gender segregation was undue and not inherently discriminatory, the court concluded that the report "cannot be promulgated in its current form."

However other aspects of Ofsted's strong criticism of the school were upheld and the judge said that Ofsted was "entitled to place this institution on 'special measures'."

Ofsted's report also drew attention to "offensive books" "prominently displayed in the library".

The books "included derogatory comments about, and the incitement of violence towards, women".

Discussing the books' content in his ruling, the judge said: "one of the books states that a wife is not allowed to refuse sex to her husband. Another opines that women are commanded to obey their husbands and fulfil their domestic duties. Two books made clear that a husband may in certain circumstances beat his wife, provided that this is not done 'harshly'."

The judge said that "leaders at the School conspicuously failed in allowing these books to enter, or re-enter, the library, and the report's assessment to that effect cannot be impugned."

NSS campaigns director Stephen Evans commented: "It is clear what view the Islamic ethos of the school takes about women from the content of the books. In this instance 'separate but equal' is not equal at all. The segregation of girls and boys is not coincidental."

The judge said that Ofsted had not "laid the groundwork" for an argument that "Islamic schools segregate because their religion (or their interpretation of it) views girls and women as second-class citizens". Had Ofsted done so, "I would have been duty-bound to address the issue."

The ruling said it was not "axiomatic" that separating students by gender was inherently discriminatory.

Ofsted also highlighted "the inadequacy of opportunities to help pupils understand the risks associated with issues such as forced marriage and sexting, and weaknesses in record-keeping in relation to child protection case files."