A man armed with a hammer shouted "this is for Syria" and wounded a policeman before being shot and wounded by other officers on Tuesday outside Notre Dame Cathedral in Paris, one of France's most famous tourist sites.
The Paris prosecutor's office swiftly launched a counter-terrorism investigation into the attack, the first since President Emmanuel Macron won power last month and days before the first round of a parliamentary election in France.
Interior Minister Gerard Collomb said the attacker was carrying the identification card of an Algerian student and that preliminary information indicated he had acted alone.
Dozens of armed police sealed off the area and put the Gothic cathedral into lockdown with nearly 1,000 tourists and worshippers inside.
The incident came three days after militants drove a van at high speed into pedestrians in London before stabbing revelers on the street and in nearby bars, killing seven people and wounding dozens.
That followed a suicide bombing in the northern English city of Manchester that killed 22 people.
"This happens nearly every week now. I just hope it has nothing to do with the election," David Stoklo, an American visitor to Paris, told Reuters TV.
Tuesday's attack will put a renewed focus on France and Europe's struggle to deal with unsophisticated, low-tech attacks in the countdown to the first round of the parliamentary election on Sunday. A second round will be held on June 18.
Macron's rivals portrayed him as weak on security during the presidential election campaign. Collomb said fighting terrorism was the president's "number one" priority.
It was too early to tell if the attack would have any impact on the outcome of the two-round parliamentary election. A poll published earlier on Tuesday showed Macron's new Republic on the Move party heading for a landslide win.
Anna Levy, an American tourist, said she had been about to enter the cathedral when she heard gunshots.
"It was just scary because you didn't know what was happening. People were just running," she said.
Inside the cathedral when the attacker struck were about 900 holidaymakers and worshippers. One of them, Dean Blair, posted on Twitter: "Not the holiday experience wanted. Trapped in Notre Dame Cathedral after police shoot a man. We are with our 2 terrified children."
Macron wants to extend a state of emergency that has been in place since jihadi gunmen and suicide bombers killed 130 people in coordinated attacks on entertainment venues in Paris in late 2015.
In total, more than 230 people have died in attacks across France in the past two-and-a-half years, most of them claimed by Islamic State.
Tuesday's attack had parallels with one in April when a militant shot dead one police officer and wounded two others on Paris' Champs-Elysees boulevard. Other attacks have targeted the security forces and have been noticeable for their simplicity.
"We have moved on from sophisticated terrorism to a form of terrorism where any object can be used to attack," Collomb told reporters.
He echoed British Prime Minister Theresa May who in the wake of the London Bridge attack said Britain was facing a new trend where militants are inspired by "copying one another and often using the crudest of means of attack".