A history teacher beheaded in a Paris suburb on Friday had been the target of online threats for showing pupils cartoons of the Prophet Mohammed in class, France's anti-terror prosecutor said on Saturday.

The father of a schoolgirl had sought 47-year-old teacher Samuel Paty's dismissal and launched an online call for "mobilisation" against him after the lesson on freedom of expression, Jean-Francois Ricard said in a televised news conference.

Paty was decapitated outside his school in Conflans-Sainte-Honorine, northwest of the capital, and the killer was fatally wounded by police.

Emmanuel Macron
French President Emmanuel Macron arrives at the scene of the attack Photo: AFPTV / David CANTINIAUX

The Russian embassy in Paris said the suspect was Abdullakh Anzorov, whose family had arrived in France when he was six and requested asylum.

The 18-year-old had received a residence permit this year, according to the embassy, and had no links with Russia.

The schoolgirl's father and a known Islamist militant are among 10 people arrested.

Emmanuel Macron
The killing bore the hallmarks of "an Islamist terrorist attack", President Emmanuel Macron said as he visited the scene Photo: POOL / ABDULMONAM EASSA

Ricard said the school received threats after the class in early October, which featured the controversial caricatures -- one of the prophet naked -- with the girl's father accusing Paty of disseminating "pornography".

The girl and her father lodged a criminal complaint against the teacher, who in turn filed a complaint of defamation, said Ricard.

The aggrieved father named Paty and gave the school's address in a social media post just days before the beheading which President Emmanuel Macron has labelled an Islamist terror attack.

France beheading
The beheading of a teacher on the outskirts of Paris has shocked France Photo: AFP / Abdulmonam EASSA

And early this week, he posted a video in which he said Islam and the prophet had been "insulted" at the school.

France beheading
The attack took place in Conflans Saint-Honorine, a northwestern suburb around 30 kilometres from central Paris Photo: AFP / Laurence SAUBADU

Ricard did not say if the attacker had any links to the school, pupils or parents, or had acted independently in response to the online campaign.

Witnesses said he was spotted at the school on Friday afternoon asking pupils where he could find Paty.

A photograph of Paty and a message confessing to his murder were found on the assailant's mobile phone.

He was in turn shot nine times, said Ricard.

Locals in the Normandy town of Evreux where the attacker lived in the Madeleine district described him as low key.

France beheading
The middle school where the teacher worked in Conflans-Saint-Honorine, a usually quiet northwestern suburb 30 kilometres from central Paris Photo: AFP / Bertrand GUAY

One who had been to school with him said he had become noticeably religious in recent years.

"Before, he got involved in fights but for the last two or three years he had calmed down" and had been " immersed in religion", he said.

"He said his prayers, he wasn't out, he spoke politely," he added.

France beheading
People hold a sign reading 'I am a teacher - Freedom of speech' outside the school where Paty worked Photo: AFP / Bertrand GUAY

Friday's attack was the second such incident since a trial started last month into the January 2015 massacre at the offices of the Charlie Hebdo satirical magazine, which had published caricatures of the prophet that unleashed a wave of anger across the Islamic world.

The magazine republished the cartoons in the run-up to the trial, and last month a young Pakistani man wounded two people with a meat cleaver outside Charlie Hebdo's former Paris offices.

Ricard said Paty's murder illustrated "the very high level terrorist threat" France still faces.

Those arrested included four close family members of the suspect, said the prosecutor.

Police also arrested a friend of the schoolgirl's father who had gone with him to see the principal to demand Paty's dismissal.

The friend, a known Islamist militant, was already on the radar of French intelligence services.

An arrest warrant is out for the father's half sister, who has joined Islamic State group fighters in Syria.

The attacker himself was not known to the French intelligence services, said the prosecutor.

An investigation is under way into "murder linked to a terrorist organisation".

The investigation will also look at a tweet from an account opened by the attacker, and since shut down, that showed a picture of Paty's head and described Macron as "the leader of the infidels".

Macron's office said a national tribute would be held for Paty on Wednesday.

On Saturday, hundreds of pupils, teachers and parents flooded to Paty's school to lay white roses.

Some carried placards stating: "I am a teacher" and "I am Samuel" -- echoing the "I am Charlie" cry that travelled around the world after the 2015 Charlie Hebdo killings.

Martial, a 16-year-old pupil, said Paty had loved his job: "He really wanted to teach us things."

According to parents and teachers, Paty gave Muslim children the option to leave the classroom before he showed the cartoons, saying he did not want their feelings hurt.

Virginie, 15, said Paty showed the cartoons every year as part of a discussion about freedom following the Charlie Hebdo attack.

Copyright AFP. All rights reserved.