Pakistani Prime Minister Imran Khan accused French President Emmanuel Macron on Sunday of "attacking Islam", after the European leader criticised Islamists and defended the publication of cartoons depicting the Prophet Mohammed.

Khan's comments follow statements Macron made last week after a French teacher was beheaded near Paris after he had shown cartoons of the Prophet during a class he was leading on free speech.

Macron said the teacher "was killed because Islamists want our future."

In a series of tweets, Khan said the remark would sow division.

"This is a time when Pres Macron could have put healing touch & denied space to extremists rather than creating further polarisation & marginalisation that inevitably leads to radicalisation," Khan wrote.

"It is unfortunate that he has chosen to encourage Islamophobia by attacking Islam rather than the terrorists who carry out violence, be it Muslims, White Supremacists or Nazi ideologists."

Imran Khan said Macron's remark would sow division
Imran Khan said Macron's remark would sow division AFP / -

Macron already sparked controversy earlier this month when he said "Islam is a religion that is in crisis all over the world".

The French teacher became the target of an online hate campaign over his choice of lesson material -- the same images that sparked a bloody assault by Islamist gunmen on the offices of satirical magazine Charlie Hebdo, the original publisher, in January 2015.

Caricatures of Mohammed are forbidden by Islam.

Blasphemy is an explosive issue in ultra-conservative Pakistan, where anyone deemed to have insulted Islam or Islamic figures can face the death penalty.

"By attacking Islam, clearly without having any understanding of it, President Macron has attacked & hurt the sentiments of millions of Muslims in Europe & across the world," Khan said.

In an address to the United Nations last month, Khan, a populist leader who has been known to play to Pakistan's hardline religious base, blasted Charlie Hebdo for re-publishing the cartoons, saying "wilful provocations" should be "universally outlawed".

Several Muslim countries have called for a boycott of French goods.