A high school in a western German city has banned Muslim pupils from publicly praying, saying that all the religious acts associated with it are "provocative" to other pupils, sparking a heated debate about freedom of religion in the country.

The school in Wuppertal sent a note to staff in February asking them to "identify" and "report" any cases of Muslim pupils praying on the school premises to the administration.

Several teachers and pupils had reported that they felt pressured by the behaviour of Muslim pupils, a spokeswoman for the regional administration of Wuppertal told the DPA news agency on Thursday.

"In the last few weeks, it has increasingly been observed that Muslim students are praying, quite visibly to others, indicated by ritual washing in the bathrooms, the rolling out of prayer rugs, and by the students putting their bodies in certain positions. That is not permitted," the letter had reportedly said.

READ MORE: '10 attacks a day' against refugees, shelters in Germany

The letter was posted last week on Facebook, provoking an angry reaction from some social media users who attacked the school's decision.

After the criticism, municipal authorities said the wording was "unfortunate" and the school had only meant to bring affected students in to discuss a solution to allow their prayer, the German newspaper Bild reported on Thursday.

Authorities say the school was, however, legally allowed to stop people "praying in a provocative manner".

The regional administration said it backed the school's stance.

"Banning provocative praying in the school's public space should promote peaceful coexistence and peace within the school," the administration said.

READ MORE - Angela Merkel: Full-face veil must be banned in Germany

The school's prayer ban came as Germany, which has taken in more than 1.1 million refugees and migrants from predominantly Muslim countries, sees a rise in anti-Islam and anti-immigration sentiment.

The country's right-wing populist Alternative for Germany (AfD), which has been making big gains in a series of recent elections, has now adopted an anti-Islam stance as part of its new manifesto.

Commenting on the school's move in a Facebook post, the AfD's Wuppertal branch called it an "interesting and "sensible" measure.