France on Sunday shrugged off the siren call of right-wing populism that enchanted voters in the United States and United Kingdom, ­rejecting anti-E.U. firebrand ­Marine Le Pen and choosing as its next president Emmanuel Macron, a centrist political neophyte who has pledged to revive both his struggling country and the flailing continent.

The result brought to a close a tumultuous and polarized campaign that defied prediction at nearly every turn, although not at the end. Pre-election polls had forecast a sizable Macron victory, and he delivered — winning some 66 percent of the vote.

The landslide was just the latest blow in 2017 for far-right movements that had seemed to be on the march last year but have suffered setbacks in recent months across continental Europe.

In a pointed endorsement of European unity, Macron strode to the stage at his raucous victory party in the grand central courtyard of Paris’s Louvre Museum on Sunday night to the strains of Beethoven’s “Ode to Joy” theme, the European Union’s anthem.

“The task that awaits us, my fellow citizens, is immense and it starts tomorrow,” Macron said as thousands of supporters cheered and waved French flags.

(Reuters)

Alluding to the deep divisions laid bare by the campaign, he said Le Pen backers had “expressed an anger, a dismay, and I respect that. I will do everything possible in the five years to come so that they have no reason to vote for the extremes.”

[Macron’s unlikely path to the French presidency]

At her own gathering at a Paris restaurant and events center, a downcast Le Pen conceded defeat, telling her demoralized supporters that the country had “chosen continuity” and that the election had drawn clear lines between “the patriots and the globalists.”

She also vowed to make her National Front the “primary force of opposition” to Macron’s government.

The repudiation of Le Pen by French voters will soothe Europe’s anxious political establishment. Across the continent, mainstream politicians had feared that a victory would throw in reverse decades of efforts to forge continental integration.

But the outcome instantly puts pressure on Macron to deliver on promises made to an unhappy French electorate, including reform of two institutions notoriously resistant to change: the E.U. and the French bureaucracy.

At 39, the trim, blue-eyed and square-jawed Macron will become France’s youngest leader since Napoleon when he is inaugurated Sunday, and his election caps an astonishing rise.

1 of 38 Full Screen Autoplay Close Skip Ad × See the scene as the French elect Emmanuel Macron as their new president. View Photos French citizens across the globe vote in tense election that could decide Europe’s future, choosing pro-business progressive Emmanuel Macron over far-right populist Marine Le Pen. Caption French citizens across the globe vote in tense election that could decide Europe’s future, choosing pro-business progressive Emmanuel Macron over far-right populist Marine Le Pen. Marseille, France French voters decided Sunday whether to back pro-business independent Emmanuel Macron or far-right populist Marine Le Pen as their next president, casting ballots in an unusually tense and important presidential election that also could decide Europe’s future. Philippe Laurenson/Reuters Buy Photo Wait 1 second to continue.

With a background in investment banking and a turn as economy minister under a historically unpopular president, he may have seemed an ill fit for the anti-establishment anger coursing through Western politics.

But by bucking France’s traditional parties and launching his own movement — En Marche, or Onward — Macron managed to cast himself as the outsider the country needs. And by unapologetically embracing the E.U., immigration and the multicultural tableau of modern France, he positioned himself as the optimistic and progressive antidote to the dark and reactionary vision of Le Pen’s National Front.

Le Pen, 48, has long sought to become the first far-right leader elected in Western Europe’s post-war history. Sunday’s vote frustrated those ambitions but is unlikely to end them.

By winning about 34 percent of the vote, she nearly doubled the share claimed by her father, Jean-Marie Le Pen, in the 2002 election, the only other time the National Front’s presidential candidate has made it to the second round of voting. The result seemed to cement the party’s long march from the political fringe to the center of the nation’s discontented political discourse, if not the pinnacle of its power.

[Marine Le Pen lost the French election. But her power is growing.]

Struggling with chronically high unemployment and recurrent terrorist attacks, France’s mood on the day of its presidential vote was reflected in the dark clouds and chilly spring rains that blanketed much of the country.

Nonetheless, the public voted at a rate that would be the envy of many Western democracies: From the chic neighborhoods of Paris to the struggling post-industrial towns of the French countryside, turnout nationwide was about 75 percent, down slightly from previous votes.

No matter whom French voters picked, the choice was bound to be historic.

The dominant two parties of France’s Fifth Republic were both eliminated in the first round. The center-left Socialists were decimated, brought low by the failure of incumbent President François Hollande to turn around the economy or to prevent a succession of mass-casualty terrorist attacks.

The center-right Republicans, meanwhile, missed what was once seen as a sure-fire bet at returning to power after their candidate, former prime minister François Fillon, was hobbled by a series of corruption allegations.

The two candidates who remained, Le Pen and Macron, both traced an outsider’s path as they sought residence at the Elysee Palace.

Of the two, Macron had the more direct route. But his campaign still had to overcome all the usual challenges of a start-up, plus some extraordinary ones — including the publication online Friday night of thousands of hacked campaign documents in a cyberattack that aroused suspicions of Russian meddling.

The outcome of Sunday’s vote will have profound implications not only for France’s 67 million citizens, but also for the future of Europe and for the political trajectory across the Western world.

After a pair of dramatic triumphs for the populist right in 2016 — with Brexit in Britain and Donald Trump in the United States — France’s vote was viewed as a test of whether the political mainstream could beat back a rising tide.

[A youth revolt in France boosts the far right]

Many of Europe’s mainstream leaders — both center-right and center-left — lined up to cheer Macron on after he punched his ticket to the second round in voting last month. The endorsements were a break from protocol for presidents and prime ministers, who normally stay out of one another’s domestic elections.

But they reflected the gravity of the choice that France faced. A victory by Le Pen was seen as a possible market-rattling death blow to decades of efforts to draw Europe more closely together, with the National Front leader expected to try to take the country out of both the E.U. and the euro.

Former president Barack Obama had also endorsed Macron, and the young French politician often appeared to be trying to emulate the magic of Obama’s 2008 campaign with speeches that appealed to hope, change and unity — while eliding many of the details of his policies.

The current White House occupant was cagey about his choice, saying before the first round that Le Pen was “the strongest on borders and she’s the strongest on what’s been going on in France.” Trump predicted that she would do well, but he stopped short of endorsing her.

After Macron’s victory, Trump tweeted congratulations shortly after 3 p.m. Washington time on “his big win today as the next President of France. I look very much forward to working with him!”

On the campaign trail this spring, Le Pen’s rhetoric had often echoed Trump’s, with vows to put “France first” and to defend “the forgotten France.” She also condemned globalist cosmopolitans – Macron chief among them — who she said did not have the nation’s interests at heart.

But Le Pen had distanced herself from Trump since his inauguration, often declining to mention him by name, and analysts said her association with the unpopular U.S. president may have hurt her among French voters.

Macron has almost nothing in common with Trump except one key fact: Like the New York real estate tycoon, Macron became president of his country on his first run for elective office.

The son of doctors who was raised in the northern city of Amiens, Macron had to teach himself the basics of campaigning on the fly in the white-hot glare of a presidential race.

Vowing during the campaign to borrow from both left and right, he will now have to learn how to govern a country without the backing of any of its traditional parties.

Instead, he has a movement that he built from scratch, and faces the immediate challenge of getting Onward allies elected to the National Assembly.

That vote, due next month, will determine whether Macron has the parliamentary support he needs to enact an agenda of sweeping economic reforms, many of which are likely to unsettle the country’s deeply entrenched labor unions.

Despite his victory, pre-election polls showed that most of Macron’s supporters saw themselves voting against Le Pen rather than for him.

That was reflected on the streets Sunday, with voters even in heavily pro-Macron neighborhoods of Paris saying they felt more resigned than excited.

“On the one hand you have a far-right party that will take us straight to disaster,” said Gilbert Cohen, a retired 82-year-old engineer who cast his ballot amid the vaulted ceilings of Paris’s 17th-century Place des Vosges, a former royal residence that was also home to Victor Hugo. “On the other, you have the candidate who’s the only reasonable choice we have.”

[Emmanuel Macron is 39 and his wife is 64. French women say it’s about time.]

Elsewhere in France, the mood was even more markedly downbeat. In Laon, a small and struggling city 90 miles north of Paris, many voters said they were so disillusioned by the choice that they would cast a blank ballot.

Others said their disenchantment had led them to Le Pen – and a hope that, despite the polls, she could still eke out a victory that would bring the radical break for France that they crave.

“We’ve had 50 years of rule from the left and the right,” said Francis Morel, a 54-year-old bread maker who cast his ballot for Le Pen. “Nothing has changed.”

The mood was considerably more cheerful Sunday night at the Louvre, where Macron supporters gathered in what was once the seat of French kings for their candidate’s victory party.

Valentin Coutouly, a 23-year-old student who described himself as “European to the core,” said the campaign had been a whirl of emotion, with anxiety setting in near the end. “I think we were all afraid that Le Pen could actually win,” he said.

But as the reality of a Macron presidency washed over the crowd, he could sum up his mood in three words:

“I feel relieved.”

Stanley-Becker reported from Laon. Benjamin Zagzag in Laon and Virgile Demoustier in Paris contributed to this report.

Read more:

Emmanuel Macron and Marine Le Pen, in their own words

If Le Pen beats Macron, the once-unthinkable will be all too real

Today’s coverage from Post correspondents around the world

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