The murder at a police station in Rambouillet, a commuter town about 60 kilometers (40 miles) from Paris, revived the trauma of a spate of deadly attacks last year.
The victim was a 49-year-old woman named as Stephanie M., a police administrative assistant and mother-of-two, who was stabbed twice in the throat at the entrance of the station.
Her 36-year-old attacker named as Jamel G., who had not been known to police or intelligence services, was shot and fatally wounded by an officer at the scene.
The latest violence targeting police is likely to focus attention further on the danger of extremism in France and wider concerns about security a year ahead of a presidential election.
Prime Minister Jean Castex said he would hold a meeting in Paris with ministers and security officials after the killing.
National anti-terrorism prosecutors have opened a terror investigation.
A source close to the inquiry told AFP the knifeman shouted "Allahu Akbar" (God is Greatest) during the attack.
Chief anti-terror prosecutor Jean-Francois Ricard confirmed "comments made by the assailant" indicated a terror motive.
- Security stepped up -
Jamel G's father and two other people were taken into custody on Friday, and questioning was continuing on Saturday as police delve into his background, contacts and possible motives.
The assailant had arrived in France illegally in 2009 but had since obtained residency papers, a police source said. He had just moved to Rambouillet.
Far-right leader Marine Le Pen immediately questioned why the attacker had been able to settle in the country, and hit back at recent criticism about police brutality in France.
"We need to get back to reason: supporting our police, expelling illegal immigrants and eradicating Islamism," she wrote on Twitter.
Polls show her running close to President Emmanuel Macron in next year's election, though experts warn that surveys conducted so far ahead and during a pandemic should be interpreted with caution.
About 30 police officers wearing balaclavas raided the suspect's home in Rambouillet on Friday, AFP reporters said.
At the same time police in the Paris region searched the home of the person who had sheltered Jamel G. when he first arrived in France, sources close to the inquiry said.
Interior Minister Gerald Darmanin, who also visited officers in Rambouillet, said security would be stepped up at stations nationwide.
- Spate of attacks -
France has been repeatedly targeted by extremist attackers since 2015, with a series of incidents in the last year keeping terrorism and security as a leading concern.
Macron's government has introduced legislation to tackle religious extremism, which would make it easier for the government to close places of worship and track foreign funding of mosques.
The bill has been condemned by critics who see it as stigmatizing Muslims.
Last September, a Pakistani man wounded two people with a meat cleaver outside the former offices of satirical magazine Charlie Hebdo, which had printed cartoons of Prophet Mohammad (PBUH).
In October, a young Chechen refugee beheaded teacher Samuel Paty who had showed some of the caricatures to his pupils in a crime that profoundly shocked the country.
Later that month, three people were killed when a recently-arrived Tunisian went on a stabbing spree in a church in the Mediterranean city of Nice.
In the most serious recent attack against French police, three officers and one police employee in Paris were stabbed to death in October 2019 by an IT specialist colleague who was himself then shot dead.
He was found to have shown an interest in extremism.
These attacks came after the massacres carried out by extremists from 2015 that began with the killing of staff in the offices of Charlie Hebdo in January that year.
In France's deadliest peacetime atrocity, 130 people were killed and 350 were wounded when terrorist suicide bombers and gunmen attacked the Stade de France stadium, bars and restaurants in central Paris and the Bataclan concert hall in November 2015.
The following year a man rammed a truck into a Bastille Day crowd in Nice, killing 86 people.