Teachers in Germany have set off a national controversy after they boycotted their own school’s leavers’ ceremony in protest at a Muslim pupil who refused to shake hands with a female member of staff.

The teachers demanded that the teenage pupil, who has not been named under German privacy laws, be excluded from the ceremony over the incident.

But he won the backing of the school’s head teacher, who insisted he be allowed to attend.

The row at the Kurt Tucholsky secondary school in Hamburg has renewed debate in Germany over whether religious pupils can be forced to shake hands with teachers of the opposite sex.

The dispute began at the end of an oral examination for the Abitur, the German equivalent of A levels. The teacher conducting the exam held out her hand to the pupil to congratulate him, but he refused to shake it and offered her his wrist instead.

He asked to speak to her alone, and told her “I’m not doing this out of disrespect, but for religious reasons”.

Several teachers then demanded he be excluded from the end-of-term ceremony for those who had passed the exams as a punishment.

Andrea Lüdtke, the head teacher, refused. “He is by no means a radical or extremist,” she told Hamburger Morgenpost newspaper.

Several colleagues will not participate in this event and allow an extremist to use it for misogynist religious propaganda with the approval of the school management

The school had held discussions with the pupil and did not condone his stance, she said.

“We are considering how we can send a signal that we do not tolerate such behaviour.”

Seven teachers boycotted the ceremony in protest — more than half of the 13 who taught the Abitur class.

“Several colleagues will not participate in this event and allow an extremist to use it for misogynist religious propaganda with the approval of the school management,” an anonynmous email sent to Hamburger Abendbladett newspaper read.

The ceremony went ahead, and in what was seen as a vindication of the head teacher’s stance, the pupil at the centre of the row shook hands with her in front of his fellow students.

While the pupil’s original refusal has been the subject of hot debate in Germany, the teachers’ boycott has been widely condemned.

“It also punished the other students who had been looking forward to celebrating finishing school with all their teachers. And did it help?” Heike Klovert wrote in Spiegel magazine.

Ms Lüdtke has been praised for her handling of the situation.

“She took her Muslim students seriously. She did not try to bend them to fit in with a supposedly German way of doing things . She understands that respect is not coupled to a handshake and that not everyone who doesn’t want to shake hands is the misogynist extremists,” Spiegel wrote.

The incident is not the first time handshakes have caused controversy. In June Muslim parents withdrew their child from a Berlin school after a teacher terminated a parents’ meeting because the father refused to shake hands with her.

Refusal to shake hands with members of the opposite sex is not unique to Muslims.

In 2014, Shneur Odze, a Ukip MEP candidate, caused controversy when he refused to shake women’s hands because of his Orthodox Jewish beliefs.