PARIS — The French authorities opened a terrorism investigation on Friday after a knife-wielding assailant killed a police officer at a station about 25 miles southwest of Paris before being shot dead.
France is still on high alert for terrorism after a string of attacks last fall, and Jean Castex, the prime minister, and Gérald Darmanin, the interior minister, quickly rushed to the scene of the attack in Rambouillet, a quiet, affluent town.
“She was a policewoman,” President Emmanuel Macron wrote on Twitter after the attack, identifying the victim only as Stéphanie. “We will yield nothing in the fight against Islamist terrorism,” Mr. Macron added.
Mr. Castex told reporters that the officer, who carried out administrative duties at the station, had been “cravenly” killed in “dramatic” circumstances, but he did not elaborate.
Jean-François Ricard, France’s top antiterrorism prosecutor, told reporters at the scene that his office had opened an investigation but provided few details, saying only that the assailant appeared to have scouted the area beforehand.
Mr. Ricard did not confirm French news reports that the attacker had shouted “Allahu akbar,” or “God is great” in Arabic, during the assault, saying only that the remarks he had made during the stabbing — as well as the target and the weapon used — pointed to a terrorist motive.
Linda Kebbab, a representative for Unité SGP Police Force Ouvrière, one of France’s main police unions, said that the victim was near the entrance to the police station shortly before 2:30 p.m. when the assailant stabbed her in the neck.
“It’s a terrible shock,” Aurore Bergé, a lawmaker representing the Yvelines region, which is home to Rambouillet, for President Emmanuel Macron’s party, said on Twitter.
France has been hit hard by dozens of terrorist attacks over the past decade. The most recent high-profile episodes came in October, when a history teacher was beheaded after showing cartoons of the Prophet Muhammad in a class on free speech in Conflans-Sainte-Honorine, and three people were stabbed to death at a basilica in Nice.
The stabbing on Friday took place as French lawmakers wrapped up work on a bill pushed by Mr. Macron’s government to counter Islamist extremism in France. The attack is likely to further amplify the prominence of the issue during the presidential election campaign next year.
After a wave of large-scale attacks in 2015 and 2016 that killed hundreds, France has faced smaller spikes of Islamist terrorism perpetrated by isolated, self-radicalized individuals whom intelligence services have found hard to track.
“Today we need to do a better job following the bottom of the spectrum: these individuals who are not perceived as the most dangerous, but who can take action without any forewarning,” Mr. Macron told the newspaper Le Figaro this week.
Valérie Pécresse, a top regional official, said that the assailant had struck at “a symbol of France,” a town in the countryside that she described as “so peaceful.”
Ms. Pécresse said the police station in Rambouillet was well protected and that access inside was restricted. The attacker, she said, appeared to have waited for the victim to briefly exit the building.
French security forces have been often been targeted by terrorists.
In 2016, an Islamic State assailant fatally stabbed an off-duty police officer and his companion, a police employee, at their home. In 2017, a gunman killed a veteran police officer on the Champs-Élysées in Paris. And in 2019, in one of the worst attacks on the French police to date, a radicalized police employee stabbed four of his colleagues to death at the Paris police headquarters.
The attack on Friday was followed by widespread condemnation, especially among Mr. Macron’s political opponents on the right and far-right, who have ramped up criticism of his security record ahead of France’s 2022 presidential elections and regularly blame him for doing too little to protect the police and being too soft on crime.
Marine Le Pen, the leader of the far-right National Rally party and Mr. Macron’s main rival in next year’s election, told the BFMTV news channel that Mr. Macron’s administration was synonymous with “chaos.”
“The security situation in our country has never been so critical,” Ms. Le Pen said. “I wonder if France has become the country most affected by terrorism in Europe. Does it bother the government? I’m not even sure.”
Constant Méheut and Norimitsu Onishi contributed reporting.