BERLIN — Liberalism, it turns out, isn’t dead after all.

In a year that has seen a Euroskeptic become president of the U.S. and the U.K. trigger its withdrawal from the European Union, some feared France’s election would be the coup de grâce for Western democratic ideals.

Europe’s far right boasted that Marine Le Pen would ride the transatlantic populist wave into office and lead the country out of the European Union and the euro. The optimism was justified: As recently as March, the nationalist firebrand was leading the pack in some polls. France’s far right had never been closer to victory.

Or so it seemed. In the end, the rise of President Donald Trump and Brexit influenced the French result — just not the way most had anticipated.

Any number of factors will have contributed to Emmanuel Macron’s blowout victory Sunday. Yet it’s undeniable that by elevating an unabashedly pro-EU liberal to its highest office, France wanted to send a clear message to the world that it rejects the nativist instincts that have taken hold in other parts of the West.

In other words, far from attracting voters, the Trump phenomenon scared them away.

At first, Le Pen tried hard to ride Trump’s coattails, declaring the morning after his election that they were part of a global movement that would “bury the old order.” During the transition, she even visited Trump Tower (though she didn’t meet with the man himself).

What she didn’t anticipate was the degree to which the spectacle of the Trump presidency had unnerved the French public. With about 80 percent of the French expressing a negative view of the American president, according to polls, Le Pen soon stopped mentioning him on the campaign trail.

Brexit was another wake-up call for many would-be Le Pen followers. Quitting the EU wasn’t quite as straightforward as many thought. Amid talk of the U.K. disintegrating and its economy imploding, the attractiveness of EU secession, which Le Pen put on the table by promising a referendum, quickly dissipated.

World in flux

The French aren’t the only Europeans in recent months to reject the nuclear option in the wake of the U.S. election. In both Austria and the Netherlands, voters turned out in droves to head off a populist surge and elect liberal candidates.

Macron “has to succeed because if he doesn’t the next president of [France] might be called Le Pen” — German Foreign Minister Sigmar Gabriel

In Germany, many voters had abandoned Chancellor Angela Merkel’s center-right conservatives in the wake of the refugee crisis to support the anti-immigrant Alternative for Germany (AfD) party.

More recently, they’ve been returning to the center. Support for the AfD has halved in recent months. On Sunday, Merkel’s party retook control of a state in a regional election for the first time in more than a decade.

“The world is in motion and not necessarily for the better,” said Wolfgang Bosbach, a veteran politician in Merkel’s Christian Democratic Union. “People are looking for reliability.”

In the near term, the primary beneficiary from these developments is an institution that sees itself as the epitome of stability and Western liberalism — the EU.

It’s unlikely the EU could have survived a President Le Pen, who has long harbored a deep disdain for Europe.

A Le Pen win would have opened a chasm across the Continent, a disruption of a magnitude not seen since World War II with unforeseeable consequences.

With Macron, who put the necessity of reforming the EU at the center of his campaign, the bloc would appear to have a chance for genuine renewal.

“Europe is waiting for us to defend the enlightenment,” he said during his victory speech on Sunday. “They are waiting for a new hope, a new humanism, for a safer world … Europe and the world are waiting for us. They are waiting for France to surprise them.”

Initiatives to rethink how the EU functions (albeit in less flowery terms) have been frustrated in recent years by a string of crises, from Greece to Brexit to the rise of populism.

Risk of backlash

The hope in Brussels now is that with Macron in power and a pro-EU leader expected in Germany after fall elections — most likely Merkel — the bloc has a genuine chance at introducing reform. Topping the list is an overhaul of the 19-member eurozone that would deepen integration between countries to make it less susceptible to the kind of shocks that nearly triggered its collapse during the debt crisis.

“It will be a window of opportunity that we must not miss,” European Commissioner for Economic and Financial Affairs Pierre Moscovici said in a recent interview.

Despite that urgency, the EU remains deeply divided over what shape the reforms should take. While Merkel says she’s open to the rethink, her party is one of the biggest obstacles. German conservatives worry that any move to collectivize eurozone members’ debt, for example, would leave Berlin holding the bag and have vowed to fight tooth and nail to prevent such an outcome.

A less obvious obstacle to reform could be Europe’s improving economy. For the first time in about a decade, Europe’s economy is showing real signs of life. Though that’s welcome news in a region that has been plagued by economic misery ever since the financial crisis, it might also lift the pressure to pursue controversial changes.

What worries some EU leaders is that the recent economic improvement is likely to prove fleeting. If they don’t seize the opportunity to fix the EU now, they say, the same forces that fueled the rise of the populists, such as high youth unemployment and stagnant wages, could hasten another resurgence.

For the first time in about a decade, Europe’s economy is showing real signs of life.

What’s more, if Trump succeeds in reviving the U.S. economy and continues to moderate on foreign policy, the fear European voters have of populism could wane, they say.

France, where Le Pen’s National Front remains a potent political force, is particularly exposed to a backlash. Macron’s victory may have been convincing, but he has yet to prove he can govern without a strong party apparatus behind him. It's a risk not lost on his European allies.

Macron “has to succeed because if he doesn’t the next president of [France] might be called Le Pen,” German Foreign Minister Sigmar Gabriel warned.