On Friday, a knife-wielding youth decapitated a middle school teacher on a street in Paris after the teacher showed cartoons of students portraying the Muslim prophet Mohammad naked, according to sources.

The perpetrator took responsibility shortly after the beheading and shared on Twitter a picture of his victim’s severed head, a police source told NBC News. The social-media website deleted the grisly graphic.

The assailant then challenged responding cops with an air-gun rifle as the police opened fire, killing him, and yelled “Allahu Akbar,” or “God is wonderful” in Arabic.

The working theory is extremism, “the UK’s Telegraph newspaper told a law-enforcement source.”

The 18-year-old murderer’s connexion to the school was not immediately apparent.

The authorities just claimed he was a Moscow-born ethnic Chechen, and although he was not on the French terror watch list, the Telegraph claimed that he was known to the police for his record of petty crimes.

His victim, known only as “Samuel P.” in the French press, taught history and geography.

Just a few days earlier, during a class discussion on freedom of speech, Le Monde and NBC News reported, the teacher showed his students cartoons of the prophet Mohammad from the magazine Charlie Hebdo.

In 2015, when Islamist militants targeted the magazine’s headquarters over its caricatures of the Muslim prophet, 12 individuals were killed.

Then, late last month, another jihadist used a meat cleaver outside the magazine’s former headquarters to strike and kill two citizens.

One parent told The Telegraph that before debating the naked cartoons, the slain teacher had invited Muslim pupils to leave the school, so as not to annoy them.

“He never sought to be rude at any time, that’s what my son told me,” said the father, Nordine Chaouadi, himself a Muslim.

Nevertheless, the incident riled other parents. Last week, The Telegraph published, one family, lodged a legal complaint against the teacher.

Sources told Agence-France Presse that bomb-disposal experts were on hand in Friday’s attack because of the alleged existence of an explosive vest on the attacker.

“National anti-terrorism authorities said they are probing a killing related to a” violent terrorism association” “concerning a terrorist organization, “Le Monde announced.

The beheading occurred in Conflans-Saint-Honorine, a western suburb of the French capital, on Friday afternoon, the article said.

After receiving a call about a suspicious person loitering outside the campus, police were at the scene, the study said, quoting a source in law enforcement.

President Emmanuel Macron visited the scene on Friday night of what he termed a “serious Islamist terrorist attack.”

One of our fellow people was murdered because he learned or learned freedom of speech to his students, to believe or not to believe. Our compatriot was the target of a major Islamist terrorist attack,’ said the president.

I would like to say to all the teachers in France this evening that we are with them, that the entire nation will be there today and tomorrow, by their side, to protect them, to defend them, to allow them to do their work, which is the most beautiful thing there is: to make free people. Meanwhile, in condemning the apparent Islamist terrorist threat, French lawmakers wasted no words.

Jean-Luc Melenchon, a member of the French National Assembly, said, He is defiling his faith. And he inflicts hell on us all, having to live with his kind of killers.”