PARIS — A French soldier shot and seriously wounded a man armed with machetes who attacked him Friday near the entrance to the Paris Louvre museum shouting “Allahu Akbar” (God is greatest), in what President Francois Hollande said was a terrorist attack.

Police inquiries had established that the man, who was hovering between life and death after being shot, was a 29-year-old Egyptian who arrived in France on Jan. 26 after obtaining a tourist visa in Dubai, the Paris prosecutor said.

Security sources in Cairo identified the man as Abdullah Reda al-Hamamy, who was born in Dakahlia, a province northeast of Cairo.

Police have searched an apartment the man had rented in Paris and are now working to establish whether he acted alone, on impulse, or on orders from someone, prosecutor Francois Molins told a news conference Friday night.

The man was wearing a black T-shirt with a death’s head emblem when he attacked soldiers checking bags near the museum’s shopping mall “with a machete in each hand,” Molins said.

He struck one soldier and knocked another one to the ground. When he continued his attacks the soldier on the ground shot him in the abdomen, Molins said.

Paint spray cans — but no explosives — were found in his backpack, a source close to the investigation told Reuters.

At a meeting of EU leaders in Malta, Hollande praised the courage and determination of the soldiers.

“This operation undoubtedly prevented an attack whose terrorist nature leaves little doubt,” he said.

The soldier who shot the man was from one of the patrolling groups which have become a common sight in Paris since a state of emergency was declared in November 2015 after bomb and shooting attacks by Islamist militants. An anti-terrorism inquiry has been opened, the public prosecutor said.

The other was wounded in the scalp.

More than 230 people have died in France in the past two years at the hands of attackers allied to the militant Islamist group Islamic State.

The country is less than three months away from a presidential election in which security and fears of terrorism are among key issues.

Paris also submitted its official bid to host the 2024 Olympic Games on Friday with a launch show at the Eiffel Tower.

The city has been gradually recovering from a dip in foreign tourism caused by the attacks.

More than a thousand visitors, including many young children, were kept for an hour inside the Louvre, home to Leonardo da Vinci’s “Mona Lisa” and countless other treasures, before being released.

A total of 130 people were killed in Paris in the November 2015 attacks. In another attack in the southern city of Nice in July last year, a Tunisian deliberately drove a truck into a crowd on the seafront killing 86 people.

U.S. President Donald Trump also weighed in on Friday: “A new radical Islamic terrorist has just attacked in Louvre Museum in Paris. Tourists were locked down. France on edge again. GET SMART U.S.,” he tweeted.

Police cordoned off and evacuated the area around the museum for a time on Friday but began to allow traffic to pass less than two hours after the incident.

The museum would reopen on Saturday, the French culture minister said.