Paris was plunged into panic when soldiers guarding the Louvre Museum shot an attacker who lunged at them with two machetes as the historic landmark went into lockdown.
The threat appeared to recede after the assailant was subdued, but it cast a new shadow over the city just as tourism was beginning to rebound after a string of deadly attacks.
Coming just hours before Paris finalised its bid for the 2024 Olympics, it also renewed questions about security in the City of Light.
The soldiers' quick action put an end to what French President Francois Hollande said was "no doubt" a terrorist attack at one of the city's most popular tourist attractions.
French prosecutor Francois Molins said the assailant was believed to be a 29-year-old Egyptian who had been living in the United Arab Emirates, though his identity has not yet been formally confirmed.
"Everything shows that the assailant was very determined", he said, adding that the attacker, who was shot four times, was in a life-threatening condition in a hospital.
Anti-terrorism prosecutors took charge of the investigation as police carried out raids near the tree-lined Champs-Elysees linked to the attack.
It came two months after authorities carried out a special anti-terrorism exercise around the Louvre.
The attacker was not carrying identity papers but police discovered he was a resident of the United Arab Emirates who arrived in Paris on a tourist visa on January 26.
Two days later the suspect bought two military machetes at a gun store in Paris, the prosecutor said.
He also paid €1,700 for a one-week stay at a flat in the chic 8th arrondissement of the French capital, near the Champs-Elysees.
In the apartment, police found an Egyptian passport and a residence permit, driver's licence and a credit card all issued from the UAE. The suspect's return flight to Dubai was scheduled for Sunday.
Friday's attack targeted an entrance to a shopping mall that extends beneath the sprawling Louvre, a medieval former royal palace now home to the Mona Lisa and hundreds of other masterpieces.
Waving two machetes over his head, the assailant lunged at the soldiers patrolling in the mall, shouting "Allahu Akbar!" or "God is great!"
One soldier fought him off and was slightly injured in the scalp. Another soldier fell to the ground as the assailant tried to slash him, then opened fire, shooting the attacker in the stomach.
When that did not stop him, the soldier fired three more time, gravely wounding him. The backpack the man was carrying contained cans of spray paint, but no explosives, Mr Molins said.
The 1,200 people inside the Louvre - one of the world's biggest tourist attractions - were first shuttled into windowless rooms as part of a special security protocol before being evacuated.
The museum in central Paris remained closed for the rest of Friday but will reopen on Saturday.
Mr Hollande, speaking at a news conference in Malta where he was attending an EU summit, said that while the Louvre incident was quickly contained, the overall threat to France remains high.
He said the incident showed the need for the increased security patrols deployed around France since attacks in 2015.
Those patrols - numbering about 3,500 soldiers in the Paris area - were first deployed following the January 2015 attack on Paris' satirical magazine Charlie Hebdo.
They were reinforced after the November 2015 bomb-and-gun attacks that left 130 people dead at the city's Bataclan concert hall and other sites. The country has been under a state of emergency since.
The Louvre attack came hours before the city unveiled its bid for the 2024 Olympics. Paris is competing against Budapest and Los Angeles for the games, which it has not hosted since 1924.
Speaking outside the Louvre, Paris Mayor Anne Hidalgo said terrorism threatens all of the world's big cities and "there is not a single one escaping that menace".