By Michel Rose and Elizabeth Pineau

PARIS (Reuters) - A French soldier shot and wounded a man armed with machetes and carrying two bags on his back on Friday as he tried to enter the Paris Louvre museum in what the government said appeared to have been a terrorist attack.

Initial indications were that the man, who was hovering between life and death after being shot, was an Egyptian who arrived in France at the end of January, a source close to the investigation said.

The man shouted Allahu Akbar (God is greatest) and rushed at police and soldiers before being shot and seriously wounded near the museum's shopping mall, police said. A second person was also detained after acting suspiciously.

Paintspray cans - but no explosives - were found in his back packs, a source close to the investigation told Reuters.

"The soldier fired five bullets," Michel Cadot, head of Paris police, said, describing how the man hurried threateningly towards the soldiers at around 10 a.m. (0900 GMT).

"It was an attack by a person ... who represented a direct threat and whose actions suggested a terrorist context."

At a meeting of EU leaders in Malta, French President Francois 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 following bomb and shooting attacks by Islamist militants. An anti-terrorism inquiry has been opened, the public prosecutor said.

Another soldier received a scalp wound in the incident.

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.

Story continues

Paris was also planning to submit its official bid to host the 2024 Olympic Games on Friday with a launch show at the Eiffel Tower around 1730 GMT.

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 Leonard 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.

(Additional reporting by Chine Labbe, Emmanuel Jarry, Bate Felix; Editing by Andrew Callus and Richard Balmforth)