"I would like to pay tribute the extreme reactivity and efficiency of police forces and military forces of the 'operation Sentinelle, '" Hidalgo said, adding that the injured soldier's actions likely prevented a future attack.
A photo taken inside the shopping centre by a Chinese tour guide and posted to Twitter by journalist Stephane Kovacs shows a man lying prone on the ground, surrounded by armed police officers.
Mr Lefebvre said: "That's when he got the knife out and that's when he tried to stab the soldier".
Pierre-Henry Brandet, spokesman for the French interior ministry tweeted that "This event reminds us that the threat is present and that security is everyone's business".
Two rucksacks belonging to the suspect, who shouted "God is greatest" in Arabic, have been inspected but no explosives were found.
While the attacker was not carrying any identity papers during the attack, investigators used his cell phone to determine his identity.
French Defense Minister Jean-Yves Le Drian said the targeted soldier was slightly injured in the attack but "is doing well" and would rejoin his regiment by the evening.
The soldier - part of a four-man patrol - fired five times, hitting the man in the legs and stomach and seriously injuring him.
It was thought that the suspected attacker wanted to carry out a "terrorist incident", according to Paris police chief Michel Cadot.
Cadot said cops had detained a second person who acted "suspiciously". No terrorist groups have yet claimed responsibility for the attack.
Heavily armed soldiers have been on the streets of Paris since the terrorist attacks on the city in November 2015.
The museum, one of the French capital's most popular tourist attractions, was put on lockdown after the attack and as many as 250 visitors were.
A French soldier is thought to have opened fire at a knifeman trying to enter the Louvre with a suitcase What happened at the Louvre Museum in Paris?
France has been on high alert with enhanced security measures in the wake of deadly terror attacks over the last two years. President Hollande said he would be questioned "when it is possible to do so".