France recalled its ambassador to Turkey after Turkish President Recep Tayyip Erdogan said French President Emmanuel Macron needed a mental health evaluation amid a government crackdown on Islamic extremism.

“What is the problem of this person called Macron with Islam and Muslims?” Erdogan asked rhetorically during his Justice and Development Party meeting in the central Anatolian city of Kayseri.

"Macron needs treatment on a mental level,” he added, according to the BBC. "What else can be said to a head of state who does not understand freedom of belief and who behaves in this way to millions of people living in his country who are members of a different faith?"

The French crackdown comes in response to the beheading of a history teacher near Paris by an alleged extremist.

EIFFEL TOWER STABBING INVESTIGATED AS RACIST INCIDENT, ATTACKERS SHOUTED 'DIRTY ARABS,': REPORTS

An official with the French presidency reacted in a statement hours later to the AFP news agency, announcing the country would recall its ambassador to Turkey for consultations and to meet with Macron.

"President Erdogan's comments are unacceptable. Excess and rudeness are not a method. We demand that Erdogan change the course of his policy because it is dangerous in every respect," the official said.

Macron's office pointed out that Erdogan, a devout Muslim, did not offer condolences following the brutal Oct. 16 slaying of Samuel Paty, who had shown caricatures of Islam's Prophet Muhammad in class. French judicial authorities are investigating the killing as an Islamist terror attack.

Authorities identified the suspect in Paty’s slaying as Abdoullakh Anzorov, an 18-year-old Moscow-born Chechen refugee, who was shot dead by police.

Seven others have been charged for conspiring to murder Paty, including a 14-year-old and a 15-year-old student at his school who prosecutors say the killer offered 300 to 350 euros ($355-$415) to help him identify the educator.  

FRENCH ATTACKER PAID TEENS TO POINT OUT TEACHER BEFORE BEHEADING, PROSECUTOR SAYS

In this Sunday, Jan. 20, 2020 file photo, Turkey's President Recep Tayyip Erdogan, left and French President Emmanuel Macron stand, during a group photo at a conference on Libya at the chancellery in Berlin, Germany. France has recalled its ambassador to Turkey after Turkish President Recep Tayyip Erdogan said President Emmanuel Macron needed mental health treatment and made other comments that the French government described as unacceptably rude. (AP Photo/Michael Sohn, File)

The suspects also include a student's father who posted videos on social media that called for retribution against the teacher, and an Islamist activist who helped the man disseminate the virulent messages, which named Paty and gave the school's address.

An estimated six million Muslims live in France, the largest population in Western Europe, which has created increasing challenges in the republic formed on strict secular principles known as “laïcité.”

Macron delivered a speech earlier this month outlining a legislative proposal to fight what he described as “Islamic separatism,” arguing Muslims in France risked forming a “counter-society.” Macron defined Islam as “a religion that is in crisis today all over the world” and said the proposal, if approved by Parliament, would aim “to build an Islam in France that can be compatible with the Enlightenment.”

In 2015, an attack on the offices of French satirical magazine Charlie Hebdo killed 12 people. Islamic extremists had targeted the publication for publishing cartoons of the Prophet Muhammad.

The diplomatic dispute with Erdogan also comes as tensions between NATO allies France and Turkey have intensified in recent months over issues that include the fighting in Syria, Libya and Nagorno-Karabakh, a region within Azerbaijan that is controlled by ethnic Armenian separatists. Macron has accused Turkey of flouting its commitments by ramping up its military presence in Libya and bringing in jihadi fighters from Syria.

CLICK HERE TO GET THE FOX NEWS APP

France also has sided with Greece and Cyprus in tensions with Turkey over offshore oil and gas drilling in the eastern Mediterranean, prompting criticism from Ankara.

The Associated Press contributed to this report.