French President Emmanuel Macron has said he can understand why Muslims were shocked by controversial cartoons depicting the Prophet Muhammad.
But, in an interview with broadcaster Al Jazeera, he said he could never accept the issue justified violence.
It comes after Thursday's deadly knife attack on a church in Nice, the third suspected Islamist attack in the country in little more than a month.
A row has been growing with some Muslim countries over issue of the cartoons.
Some have urged a boycott of French products as Mr Macron has defended the right to use the images in the context of freedom of speech.
Earlier this month a teacher was beheaded in a Paris suburb after showing cartoons of the Prophet Muhammad to some of his pupils.
Meanwhile Tunisia's state news agency is reporting that two people have been detained there for questioning in connection with the attack in Nice, which was carried out by a Tunisian man.
France's interior minister has said more militant attacks are likely.
On Saturday an Orthodox priest was shot and wounded in the city of Lyon, though no details about the attacker are known as yet.
What did Mr Macron say?
The French president said he believed strong reactions had come from Muslim nations because people had mistakenly thought that he supported the cartoons, or even that they had been created by the French state.
"I understand the sentiments being expressed and I respect them. But you must understand my role right now, it's to do two things: to promote calm and also to protect these rights," he said, referring to the freedom of expression of those who created the cartoons.
"Today in the world there are people who distort Islam and in the name of this religion that they claim to defend, they kill, they slaughter… today there is violence practised by some extremist movements and individuals in the name of Islam."
Mr Macron also said a boycott of French goods proposed amid anger at the cartoons was "unworthy" and "unacceptable".
What is the context of Mr Macron's remarks?
Three people were stabbed to death in Nice on Thursday by a Tunisian man who arrived in the southern French city the night before.
France has raised its national security alert to the highest level, with security increased at places of worship and schools across the country.
Earlier this month teacher Samuel Paty was beheaded in a Paris suburb after showing controversial cartoons of the Prophet Muhammad to some of his pupils.
Responding to the series of attacks, Mr Macron said France would never give in to violence.
The issue has led to tension with some Muslim-majority countries, with effigies of the French leader burnt in Bangladesh and a war of words with Turkish President Recep Tayyip Erdogan, who questioned Mr Macron's mental health.
A timeline of recent attacks in France
October 2020: French teacher Samuel Paty is beheaded outside a school in a suburb of Paris
September 2020: Two people are stabbed and seriously hurt in Paris near the former offices of Charlie Hebdo, where Islamist militants carried out a deadly attack in 2015
October 2019: Radicalised police computer operator Mickaël Harpon is shot dead after stabbing to death three officers and a civilian worker at Paris police headquarters
July 2016: Two attackers kill a priest, Jacques Hamel, and seriously wound another hostage after storming a church in a suburb of Rouen in northern France
July 2016: A gunman drives a large lorry into a crowd celebrating Bastille Day in Nice, killing 86 people in an attack claimed by the Islamic State (IS) group
November 2015: Gunmen and suicide bombers launch multiple co-ordinated attacks on the Bataclan concert hall, a major stadium, restaurants and bars in Paris, leaving 130 people dead and hundreds wounded
January 2015: Two Islamist militant gunmen force their way into Charlie Hebdo's offices and shoot dead 12 people