A High Court ruling that a school’s ban on prayer rituals is lawful should give “best-placed” headteachers “confidence” in making decisions for their pupils, the Education Secretary has said.

The Michaela Community School in north London successfully defended a legal challenge brought by a Muslim pupil over the school’s policy after she claimed it was discriminatory and “uniquely” affected her faith due to its ritualised nature.

However, the school, founded and led by headteacher Katharine Birbalsingh, a former government social mobility tsar, argued its prayer policy was justified after it faced death and bomb threats linked to religious observance on site.

In a judgment on Tuesday, Mr Justice Linden dismissed the pupil’s bid and said there was “a rational connection between the aim of promoting the team ethos of the school, inclusivity, social cohesion etc and the prayer ritual policy”.

Following the decision, Education Secretary Gillian Keegan said the ruling “should give all school leaders confidence in making the right decision for their school while prioritising tolerance and respect between those of different faiths and none”.

She added: “The Government has always been clear that heads are best placed to take decisions on what is permitted in their school on these matters, to balance the rights of all with the ethos of the school community – including in relation to whether and how to accommodate prayer.

“This judgment confirms this.”

Equalities minister Kemi Badenoch said: “This ruling is a victory against activists trying to subvert our public institutions.

“No pupil has the right to impose their views on an entire school community in this way.

“The Equality Act is a shield, not a sword, and teachers must not be threatened into submission.”

The Church of England said it believed school heads are best placed to address issues locally and would “uphold their right to do so”.

The church’s chief education officer, Nigel Genders, said: “This case does not appear to be about banning prayer in schools but relates to day-to-day decisions of a particular school in its own circumstances.

“We agree that heads and governing bodies of individual schools are best placed to address these issues locally and would uphold their right to do so.

“We do not believe this judgment challenges the principle of Freedom of Religion or Belief, or indeed Collective Worship in schools, which we strongly support.”

In the wake of the ruling, Humanists UK called on the Government to develop national guidance on religious practices in schools to address building “resentment” in the system.

The charity’s chief executive, Andrew Copson, said: “In the absence of national guidance on religious practices in schools and of a serious national discussion about existing laws, cases like this will continue to be brought. Schools shouldn’t be left alone to deal with this.

“Today’s High Court judgment requires serious thinking from the Government about how to protect the child’s freedom of religion or belief while also making sure our education system is fair and inclusive to all.”

Secular campaigners said the ruling serves as a reminder that claims of religious freedom “do not trump all other considerations”.

Stephen Evans, chief executive of the National Secular Society, also welcomed the judgment.

He said: “If a school wishes to uphold a secular ethos, it should be entitled to do so.

“Schools should be environments where everyone feels welcomed and valued, but that doesn’t mean students have untrammelled religious freedom.

“Where the manifestation of religion is deemed divisive or disruptive, a balance must be struck. We’re pleased the school’s actions have been vindicated.”