A high court judge has said activists protesting against LGBT equality lessons had “grossly misrepresented” what was being taught to children as he ruled that they would be permanently banned from demonstrating directly outside a Birmingham primary school.

Protesters went head to head with a local authority during a five-day hearing to stop demonstrations outside Anderton Park school. The school, in the Sparkhill area of the city, has become the focus of a long campaign to halt LGBT equality messages being taught in the classroom.

Most of the protesters have been of Muslim faith and some have stood regularly outside the school chanting “Let kids be kids” and carrying placards with the message: “Adam and Eve, not Adam and Steve.”

Birmingham city council launched court action to prevent more protests outside the school after about 300 people gathered at the gates in May. The demonstration included a highly controversial speech by an imam who claimed anal sex, paedophilia and “transgenderism” were being taught in schools.

At the centre of the case was the school’s teaching and whether children were being taught inappropriate content on LGBT issues. The local authority maintained it was not seeking to curtail free speech but wanted to contain anti-social behaviour which had become a regular feature of protests and was having a “significant adverse impact” on pupils, teachers and the local community.

During the hearing in October, local residents told how they were feeling alarmed and distressed as the demonstrations became increasingly intimidating, with one resident suffering panic attacks and another “pleading with bystanders” to make the protests stop.

Meanwhile, children at the school had to be kept inside with all the windows locked to avoid the “intolerable” noise from protesters on megaphones and often involving people with no direct connection to the school.

The educational psychologist Amanda Daniels told how she was urgently called in to provide support for 21 members of staff at the school who were exhibiting symptoms of stress, including sleeping difficulties and anxiety, because of the “persistence of the trauma”. Daniels said the levels of anxiety she witnessed amongst staff were significantly greater than anything she had seen in her eight years of responding to “critical incidents”.

Delivering his verdict, Mr Justice Mark Warby said a protest exclusion zone would permanently remain outside the school and protesters would no longer be able to use any amplification devices. He also ordered the protesters to pay 80% of the court costs.

He said: “The judgment notes that the true position so far as the teaching is concerned has been misrepresented, sometimes grossly misrepresented, in the course of the protests. Speakers … have alleged that it [the school] is pursuing a ‘paedophile agenda’, and teaching children how to masturbate. None of this is true.”

An emergency interim order was granted, and later extended in June, which sought to halt any further gatherings near the primary school that could disrupt pupils or intimidate staff.

The temporary injunction, which has been made permanent, banned Shakeel Afsar, his sister Rosina Afsar – who had two children at Anderton Park but has since removed one of them – and Amir Ahmed from coordinating protests outside the school.

All three defendants gave evidence at the week-long hearing and contested the need for a legal injunction to curtail protests. The Christian campaigner John Allman from Okehampton, Devon, also opposed the imposition of what he claimed would be a “super-injunction” and went on to score the only victory in the case when Justice Warby lifted his earlier ban on social media criticism of LGBT teaching, accepting the argument for free online speech.

Following the ruling, Dr Tim O’Neill, director of education and skills at Birmingham city council, said the judgment had vindicated the school and would protect the community from escalating levels of anti-social behaviour.

He said: “As this court case has demonstrated, there remains a gap between the reality of what is and isn’t being taught at the school. Protests of this kind only serve to attract fringe elements whose aim is to stoke division and hatred.”

Meanwhile, in a press conference following the verdict, the protesters said an appeal was “highly likely” and their campaign would go on with protests at the edge of the exclusion zone continuing.

Afsar and Ahmed repeatedly claimed the weekly demonstrations, held just yards from classrooms and featuring megaphones and a sound-boosting PA system, were “peaceful”.

Afsar, a businessman who has no children at the school, claimed protests were only triggered because the headteacher, Sarah Hewitt-Clarkson, had not properly consulted parents about relationship teaching. He further argued education material used was not age appropriate, and claimed the school was “over-emphasising a gay ethos”.

Immediately after the ruling, Afsar said he was “bitterly disappointed” with the case’s outcome. “I do regret to say that I feel the court’s approach in their case has been very one-sided,” he said.

Hewitt-Clarkson said she was “happy” with the ruling. Speaking outside court, she said: “We will carry on doing what we do. When people say things about you that are not true, that is very difficult. It has taken us to come to the high court to clear that up.

“We are particularly thrilled that the school has not been criticised at all in anything the judge has said.”

Paul Whiteman, general secretary of NAHT, which represents leaders in the majority of schools, and has been supporting the schools affected by protests in Birmingham, said the judgment made it “abundantly clear” that the school gate is no place to hold a protest.

“These protests have been widely and rightly condemned and they should now be brought to an end with immediate effect,” he added.

A Department for Education spokesperson said: “We’ve long said we want to end these protests and encourage positive dialogue, so we welcome the high court’s decision.”