Malaysia’s former prime minister, Mahathir Mohamad, has said that Muslims have the right “to kill millions of French people”.

Mahathir’s statement came after three people were stabbed to death – two of them beheaded – at a church in the city of Nice by a knifeman shouting “Allahu Akbar”.

The knifeman was later shot 14 times and wounded by armed police.

Mahathir Mohamad, who lost power in February this year, said freedom of expression does not include “insulting other people” as anger over satirical cartoons of the Prophet Mohammed sweeps the Islamic world.

The 95-year-old politician said he did not approve of the beheading of a French school teacher for sharing caricatures of the Prophet, but added that, “Irrespective of the religion professed, angry people kill”.

“The French in the course of their history [have] killed millions of people. Many were Muslims,” he said in a tweet which has since been removed for violating the website’s rules.

Mahathir continued: “Muslims have a right to be angry and to kill millions of French people for the massacres of the past.”

The Malaysian politician said that “by and large”, Muslims have not applied the principle of “eye for an eye”.

“Muslims don’t. The French shouldn’t. Instead the French should teach their people to respect other people’s feelings,” Mahathir, who has drawn controversy for comments about Jews and LGBT people in the past, added.