Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A soldier opened fire Friday on a man armed with two machetes in an underground mall close to the world-famous Louvre museum in Paris, French prosecutors said.

The attacker, who was captured at the scene, was not identified, but later described him as a 29-year-old Egyptian national who traveled to France from Dubai on a two-month visa.

Law enforcement found a plane ticket to return to Dubai on Sunday in his possession, Paris prosecutor Francois Molins said at a news conference.

Earlier, the head of the French capital's police force, Michel Cadot, said the man shouted "Allahu akbar" — Arabic for "God is great" — during the incident.

A confrontation ensued around 10 a.m local time (4 a.m. ET) after a four-man patrol of soldiers told the man he could not proceed into the mall while carrying two backpacks, officials said.

"That's when he got the knife out and that's when he tried to stab the soldier," police union official Yves Lefebvre told The Associated Press.

The man rushed at the soldiers, who attempted to fight him off, before one opened fire on him.

The Carrousel du Louvre mall, where the incident took place, runs underneath and has an entrance to the museum, which is home to works of art including the "Mona Lisa."

Police officers take position outside the Louvre museum in Paris on Friday. Thibault Camus / AP

"We are dealing with an attack from an individual who was clearly aggressive and represented a direct threat, and whose comments lead us to believe that he wished to carry out a terrorist incident," Cadot said.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The soldier fired five shots and the suspect was seriously wounded in the incident, according to Cadot.

He said that no explosives had been found in the man's baggage. He was found to have been carrying two machetes.

A spokesman for the military force that patrols key sites in Paris said the one soldier who was slightly injured by the attacker was not the one who opened fire.

France's Interior Ministry said that the man was alive when he was pulled from the scene.

The body of a man lays on the floor as two soldiers stand guard over him at the scene in Paris on Friday. AP

Both the wounded soldier and the attacker are reportedly being treated at a hospital in central Paris.

Anti-terrorism prosecutors opened an investigation into the incident.

People in the area at the time of the incident described the scene as events unfolded.

"It was very frantic at first — lots of alarms," Taylor Walstrum, a 20-year-old junior from the University of Georgia, told NBC News.

"We were led down to a room where we waited for two or three hours. Really weren't told anything other than the inside of the museum was secure,” he added.

French security forces held people inside a Paris mall near the Louvre museum, after a soldier shot a man armed with a knife. twitter.com/nonenoone3 / twitter.com/nonenoone3

Walstrum said that he was held with around 150 people in the museum's Mona Lisa room, before they were patted down and released.

“I was in the open courtyard in front of the glass pyramid entrance,” Byron Hood, 41, told NBC News. “I just saw the armed guards running and the evacuation tunnels opening.”

Hood did not see the attacker.

Police said that a second person who was behaving suspiciously had been arrested. Officials said the individual did not appear to be connected to the attack, but that prosecutors would determine if they were involved.

Interior Ministry spokesman Pierre-Henry Brandet told the AP that around 1,000 people were held inside secure areas of the museum during the incident for their own safety.

Authorities said they would be released in small groups once they had been vetted.

French President Francois Hollande reacted to the attacks, saying on Twitter: "I salute the courage and determination demonstrated by the military this morning."

In addition, President Donald Trump weighed in on the attack on his personal Twitter account early 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. — Donald J. Trump (@realDonaldTrump) February 3, 2017

Staff returned to the shops in the mall by around 12:30 p.m. local time (6:30 a.m. ET) and roadblocks were cleared from the surrounding area.

France has been under a state of emergency since the 2015 terrorist attacks in Paris that killed 130 people.

Soldiers on patrol are part of security measures that have beefed-up in the wake of attacks in the capital and in Nice.

The museum is one of central Paris' biggest tourist attractions and is one of the most-visited museums in the world. France's culture minister said it will reopen Saturday.