French police shot a man dead on Friday after he allegedly decapitated a teacher near Paris.
Officers shot the suspected killer dead, the official continued.
Prosecutors said they were treating the incident as "a murder linked to a terrorist organization" and related to a "criminal association with terrorists".
"One of our fellow citizens was assassinated because he taught his students freedom of expression", Macron said after he arrived to the Paris suburb of Conflans-Sainte-Honorine, where the attack took place. "Our compatriot was the victim of a characteristic Islamist terrorist attack".
The attacker was severely injured after being shot by police in a neighbouring town, sources close to the investigations said.
The teacher had received threats after opening a discussion "for a debate" about the caricatures about 10 days ago, the police official said.
French anti-terrorism authorities confirmed that an investigation would be launched into the attack.
Initial reports stated that the teacher had been beheaded, but subsequent reports have said that the attacker instead slit the teacher's throat.
The victim of the attack was a local middle school teacher, according to French police. Major French newspaper Le Figaro reports the officers ordered the man to drop his weapons and when he didn't and acted aggressively towards them they opened fire, killing him.
France's interior minister is understood to be travelling to the area.
France has over the past several years seen a series of violent attacks carried out by religious extremists.
Last month, charges were brought against a 25-year old Pakistani man who wounded two people with a meat cleaver to avenge the publication of caricatures of the Prophet Mohammed by the satirical weekly Charlie Hebdo.