Male Muslim students at a school in northern Switzerland will no longer have to shake hands with their female teachers, following a ruling that has caused an uproar across the country.

A school in the northern municipality of Therwil, in the canton of Basel, reached the controversial decision after two male students, aged 14 and 15, complained that the Swiss custom of shaking hands with the teacher is counter to their religious beliefs if the teacher is a woman.

They argued that Islam does not permit physical contact with a person of the opposite sex, with the exception of certain immediate family members.

The local Therwil council did not support the school's decision, but said it "will not intervene as [it] is the responsibility of the school to set the rules," spokeswoman Monika Wyss said.

The decision triggered an outcry across Switzerland, with the Justice Minister Simonetta Sommaruga insisting on Swiss public television Monday that "shaking hands is part of our culture".

Basel-Country canton authorities, who have the power to overturn the Therwil council decision, did not immediately respond to requests for comment.

But the canton's education chief Monica Gschwind said she viewed the school's decision as "pragmatic", although "not a lasting solution".

Good manners or theologically prohibited?

Felix Mueri, who heads the parliamentary commission on science, education and culture, described the custom to the 20Minuten news site as "a gesture of respect and good manners".

"We cannot tolerate that women in the public service are treated differently from men," said Christoph Eymann, who heads the Swiss Conference of Cantonal Ministers of Education.

Meanwhile, Muslim groups decried the debate around the issue.

"One would think that the continued existence of Switzerland's core values was at stake, when this particular case in fact involves just two high school students who have said they wish to greet their teacher in a different way than with a handshake," the Islamic Central Council of Switzerland said in a statement.

The group said: "classical [Islamic] jurisprudence and the vast majority of contemporary legal scholars ... assume a clear prohibition of this contact form [handshakes] between the sexes."

However, the Federation of Islamic Organizations in Switzerland (FIOS) said handshakes between men and women were "theologically permissible" and were common in some Muslim countries, insisting the issue should not be problematic in Switzerland.

AFP