PARIS (AP) — French President Emmanuel Macron comfortably won reelection to a second term Sunday, according to polling agencies’ projections. In the midst of Russia’s war on Ukraine, the result offered the European Union the reassurance of stable leadership in the bloc’s only nuclear-armed power and was immediately hailed by France’s allies.

A second five-year term for the 44-year-old centrist spared France and Europe from the seismic upheaval of a shift of power to firebrand populist Marine Le Pen, Macron’s presidential election challenger who quickly conceded defeat but still appeared on course for her best-ever showing.

Acknowledging that “numerous” voters cast ballots for him simply to keep out Le Pen’s fiercely nationalist far-right policies, Macron pledged to reunite the country “filled with so many doubts, so many divisions” and work to assuage the voter anger that fed Le Pen’s campaign.

No one will be left by the side of the road,” he said in a victory speech against the backdrop of the Eiffel Tower and a projection of the blue-white-and-red tricolor French flag.

“We have a lot to do and the war in Ukraine reminds us that we are going through tragic times where France must make its voice heard,” he said, as several hundred supporters happily waved French and EU flags to the beat of Daft Punk’s “One More Time.”

During her campaign, Le Pen pledged to dilute French ties with the 27-nation EU, NATO and Germany, moves that would have shaken Europe’s security architecture as the continent deals with its worst conflict since World War II. Le Pen also spoke out against EU sanctions on Russian energy supplies and faced scrutiny during the campaign over her previous friendliness with the Kremlin.

A chorus of European leaders hailed Macron’s victory. “Democracy wins, Europe wins,” said Spanish Prime Minister Pedro Sánchez.

“Together we will make France and Europe advance,” tweeted European Commission President Ursula von der Leyen.

Italian Premier Mario Draghi hailed Macron’s victory as “splendid news for all of Europe” and a boost to the EU “being a protagonist in the greatest challenges of our times, starting with the war in Ukraine.”

Macron went into the vote with a sizeable lead in polls but faced a fractured, anxious and tired electorate. The war in Ukraine and the COVID-19 pandemic battered Macron’s first term, as did months of violent protests against his economic policies, which created fertile ground for Le Pen.

With the EU’s only seat on the U.N. Security Council and only nuclear arsenal, the outcome in France was being watched across the 27-nation bloc. France has played a leading role in international efforts to punish Russia with sanctions and is supplying weapons to Ukraine.

Appealing to working-class voters struggling with surging prices, Le Pen vowed that bringing down the cost of living would be her priority and argued that Macron’s presidency had left the country deeply divided.

Macron sought to appeal to voters of immigrant heritage and religious minorities, especially because of Le Pen’s proposed policies targeting Muslims and putting French citizens first in line for jobs and benefits. He also touted his environmental and climate accomplishments, hoping to draw in young voters who backed left-wing candidates in round one….By John Leicester

Associated Press journalists Thomas Adamson, Sylvie Corbet and Elaine Ganley in Paris, Michel Spingler in Henin-Beaumont, and Alex Turnbull in Le Touquet, contributed.