Malaysia's former leader Mahathir Mohamad tweeted Thursday Muslims had a right "to kill millions of French people" after a deadly attack in Nice, sparking widespread anger and prompting Twitter to delete his post.
Three people were killed at a church in the southern French city, with the attacker slitting the throat of at least one of them, in what authorities were treating as the latest jihadist assault to rock the country.
Shortly afterwards, Mr Mahathir - who was prime minister of Muslim-majority Malaysia until his government collapsed in February - launched an extraordinary outburst in a series of tweets.
Referring to the beheading of a French teacher who showed pupils cartoons of the Prophet Mohammed, Mr Mahathir said he did not approve of that attack but freedom of expression does not include "insulting other people".
"Irrespective of the religion professed, angry people kill," said the outspoken 95-year-old, who has in the past drawn controversy for remarks attacking Jews and the LGBT community.
"The French in the course of their history has killed millions of people. Many were Muslims. Muslims have a right to be angry and to kill millions of French people for the massacres of the past."
But he added that "by and large the Muslims have not applied the 'eye for an eye' law. Muslims don't. The French shouldn't."
Mr Mahathir, who served as Malaysian premier twice for a total of 24 years, said that French President Emmanuel Macron was "not showing that he is civilised", adding he was "very primitive".
"The French should teach their people to respect other people's feelings. Since you have blamed all Muslims and the Muslims' religion for what was done by one angry person, the Muslims have a right to punish the French.
"The boycott cannot compensate the wrongs committed by the French all these years."
He made no direct reference to the Nice attack.
His comments sparked widespread condemnation, with social media users labelling them "outrageous" and "disgraceful".
Twitter initially flagged his tweet about killing "millions of French people" as "glorifying violence" but did not remove it.
However, shortly afterwards, the tweet was deleted entirely.
The beheading of the teacher, Samuel Paty, prompted Mr Macron to promise a crackdown on Islamic extremism.
But the move has inflamed tensions, with protests against France erupting in several Muslim countries, and some urging a boycott of French goods.