A knifeman stabbed a woman working for the police in the entrance to a police station in Rambouillet, near Paris, on Friday, Interior Minister Gerald Darmanin said.
The victim died of her injuries, BFM TV and Europe 1 reported.
The assailant was shot and overpowered by police officers. BFM TV reported that he was of Tunisian nationality and had been shot dead.
He had watched religious videos glorifying acts of jihad just before carrying out his attack, said France’s anti-terrorism prosecutor Jean-Francois Ricard.
The murder has shocked France, which faces a presidential election next year at which issues such as fears over terrorist attacks, immigration and violent crime will dominate the agenda.
Ricard told a news conference that the official investigation had shown that the assailant, identified as “Jamel G”, looked at the videos on his phone just before his knife attack on the police worker, a mother-of-two called Stephanie.
“The attacker, just before carrying out his act, had looked at religious chants and videos glorifying jihad and martyrdom,” said Ricard, who added that the assailant had also shouted out “Allahu Akbar”, or “God is Greatest”, during the attack.
French President Emmanuel Macron said, in reaction to the killing in Rambouillet, that France had again been the victim of a terrorist attack.
Ricard said France was working with Tunisian authorities in its probe into the Rambouillet attack. The Tunisian Embassy in Paris condemned the attack, in a statement.
France has experienced several attacks by Islamist militants in recent years.
Bombings and shootings in November 2015 at the Bataclan theatre and other sites around Paris killed 130 people, and in July 2016 an Islamist militant drove a truck through a crowd celebrating Bastille Day in Nice, killing 86.
Last October, a French schoolteacher was beheaded in Conflans, another commuter suburb near Paris, by a Chechen teenager who was then shot dead by police.