France has recalled its ambassador to Turkey for consultations after President Recep Tayyip Erdogan insulted his French counterpart Emmanuel Macron.
He said Mr Macron needed a mental health check for pledging to defend secular values and fight radical Islam.
Mr Macron has spoken out forcefully on these issues after a French teacher was murdered for showing cartoons of the Prophet Muhammad in class.
France "will not give up our cartoons", he said earlier this week.
Depictions of the Prophet Muhammad can cause serious offence to Muslims because Islamic tradition explicitly forbids images of Muhammad and Allah (God).
But state secularism - or laïcité - is central to France's national identity. Curbing freedom of expression to protect the feelings of one particular community, the state says, undermines the country's unity.
Responding to Mr Macron's campaign to defend such values - which began before the teacher was murdered - Mr Erdogan asked in a speech: "What's the problem of the individual called Macron with Islam and with the Muslims?"
He added: "Macron needs treatment on a mental level.
"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?"
In the wake of the remarks, a French presidential official told AFP news agency that France's ambassador to Turkey was being recalled for consultations, and would be meeting Mr 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 was quoted as saying.
Erodgan is a pious Muslim who has sought to move Islam into Turkey's mainstream politics since his Islamist-rooted AK Party came to power in 2002.
The diplomatic spat is latest issue to strain relations between France and Turkey, who are allies under Nato but disagree on a range of geo-political issues, including the civil wars in Syria and Libya, and the conflict between Armenia and Azerbaijan over disputed Nagorno-Karabakh.
Seven people, including two students, have been charged over the beheading of French teacher Samuel Paty on 16 October near Paris. His killer, 18-year-old Abdullakh Anzorov, was shot dead by police shortly after the attack, which took place near Mr Paty's school.
In 2015, 12 people were killed in an attack on the offices of French satirical magazine Charlie Hebdo. The publication was targeted by extremists for publishing cartoons of the Prophet Muhammad.
Earlier this month, Mr Macron described Islam as a religion "in crisis," and announced plans for tougher laws to tackle what he called "Islamist separatism" in France.
He said a minority of France's estimated six million Muslims were in danger of forming a "counter-society".
Some in Western Europe's largest Muslim community have accused Mr Macron of trying to repress their religion and say his campaign risks legitimising Islamophobia.