A headmistress in Germany is being investigated by police after she allegedly shouted the Nazi greeting “Sieg Heil” at the beginning of a school race on Friday.

Widely used by Nazis, users often accompanied the phrase with a right-armed salute before it was made illegal after the end of World War II.

Those who speak it are now at risk of being handed a prison sentence.

The unnamed teacher admitted to being “politically immature” and said she had intended to wish the year seven and year eight pupils good luck before a go-kart race at the secondary school in Weissenburg, Bavaria.

Children, teachers, and parents were reportedly upset by the 43-year old headmistress’ words, who took up the post in 2012.

“It just came out and now unfortunately I can't take it back,” she told the Süddeutsche Zeitung newspaper, adding that she was ready to talk about it with pupils and parents if necessary.

“How am I supposed to plausibly stop my pupils from using Nazi slogans when our boss is leading the way in them,” one teacher told the Süddeutsche.

He added that her behaviour was totally unacceptable for a person in her position.

The headmistress’ words come after a football fan was banned for three years by his club Borussia Dortmund after he shouted “Sieg Heil” during a minute’s silence before a game last month.