Armed police officers patrol the courtyard of the Louvre museum near where a soldier opened fire after he was attacked in Paris, Friday, Feb. 3, 2017. (Christophe Ena/AP)

A French soldier shot and seriously wounded a knife-wielding man Friday who attempted to attack security forces outside the Louvre museum. France’s prime minister called the assault “terrorist in nature.”

Paris prosecutor François ­Molins said at a news briefing that the attacker is a 29-year-old Egyptian national and that he was unknown to intelligence services. French media reported that he shouted “Allahu akbar,” or “God is great” in Arabic, as he charged the soldier. Molins said that for now it is unknown whether the attacker “acted on instruction” from abroad or “alone and spontaneously.”

The incident — whose “terrorist nature,” said French President François Hollande, was “hardly in doubt” — immediately stoked fears across Paris after a wave of terrorist bloodshed in the French capital and across France in the past two years. That included the November 2015 rampage through the city that claimed 130 lives and last July’s truck ramming in Nice that left 86 people dead.

In Washington, President Trump, a week after imposing a travel ban on seven Muslim-

majority nations and before any official information about the attacker had emerged, tweeted: “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.”

Marine Le Pen, the leader of the far-right, populist National Front party and an increasingly popular contender for the French presidency, issued a similar message almost immediately. “This event confirms that the poison of Islamist terrorism is far from having been eradicated and that the gravity of the problem has not yet been taken into account by public officials,” she said in a statement in French.

By contrast, most other major French politicians — including the other candidates in the upcoming elections, slated for April and May — responded by praising the bravery of the soldiers involved.

Most polls show that the openly Islamophobic Le Pen is almost certain to qualify for the second and final round of the vote. And as her principal opponent, the centrist conservative François Fillon, struggles to fend off an embarrassing nepotism scandal, Le Pen’s appeal could strengthen in the absence of a traditionally strong center-right candidate.

For months, analysts have speculated that another major terrorist aggression on the scale of the Paris or Nice attacks — and perpetrated by Islamic State militants — could boost the National Front’s slim chances of a win, lending the party a credible ­excuse to accuse the political establishment of mismanaging the migrant crisis in France as well as its national security.

In any case, the Louvre incident was far from a major terrorist attack. According to police information, the soldier assaulted Friday belonged to Operation Sentinel , an elite security patrol that critics often have considered a costly and ineffective means of fighting terrorism. With support for soldiers trending on social media, Friday’s attack could represent a victory of sorts for the oft-maligned French security services.

Molins said the attacker was armed with two machetes, one in each hand, and was carrying two backpacks as he attempted to enter the museum’s shopping center. When he was refused entry to the ­Carrousel du Louvre, a shopping mall beneath the museum, he attacked the soldier, who then fired five rounds into the attacker’s stomach, France’s Interior Ministry tweeted.

Bernard Cazeneuve, France’s prime minister, described the knife attack as clearly “terrorist in nature.” No explosives were found in the man’s bags, the Interior Ministry tweeted.

The soldier was slightly wounded in the scalp, and the attacker is in critical condition. The Interior Ministry also said a second person was arrested in connection with the attack.

Authorities evacuated the area. Officials at the Louvre, one of the world’s major tourist attractions and the historic home of the “Mona Lisa,” said the museum was closed and that visitors already inside were being kept there, according to the Interior Ministry.

The museum announced that it would reopen Saturday.

Schmidt reported from Washington.

Read more:

As France’s far-right National Front rises, memory of its past fades

A mosque is at the center of a raw debate in the South of France

Trump’s first official calls to German, French leaders set to be awkward exchanges

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news