Dutch voters headed to the polls in an election that will set the tone for a year of ballot-box drama in Europe.

Dutch voters headed to the polls in an election that will set the tone for a year of ballot-box drama in Europe, as anti-immigrant, anti-establishment campaigners test their strength against long-serving politicians and parties.

Dutch voters headed to the polls in an election that will set the tone for a year of ballot-box drama in Europe, as anti-immigrant, anti-establishment campaigners test their strength against long-serving politicians and parties.

The Dutch political establishment appeared Wednesday to fend off a challenge from anti-Muslim firebrand Geert Wilders, according to initial vote counts, a victory in a closely watched national election that heartened centrist leaders across Europe who are fearful of populist upsets in their own nations.

The result was embraced by other leaders inside and outside the Netherlands as a major blow to anti-immigrant populism, breaking a streak of disruption that started with the Brexit vote and continued with the election of Donald Trump, a skeptic of European integration. Instead, as the Netherlands’ famed tulip season gets underway, Prime Minister Mark Rutte will remain in office as he tries to form a coalition.

The vote in the prosperous trading nation was seen as a bellwether for France and Germany, which head to the polls in the coming months and have also been shaken by fierce anti-immigrant sentiment.

Wilders nose-dived in recent weeks after topping opinion polls for most of the past 18 months, as Dutch voters appeared to turn away from an election message that described some Moroccans as “scum” and called for banning the Koran and shuttering mosques.

Wednesday is “an evening where the Netherlands, after ­Brexit, after the American elections, said no to the wrong kind of populism,” Rutte told a cheering crowd in The Hague. He said he had already spoken to other European leaders to accept their congratulations.

(Video: Anna-Maria Magnusson / Full Story Media for The Washington Post)

But Wilders vowed to continue his fight, saying that his fierce message had resonated with Dutch voters and that he would prevail as the victor of the next elections.

“We’ll have to wait for the next time to make this happen,” Wilders told reporters early Thursday. “I guarantee you, this patriotic spring will start. It has already started.”

Despite the worse-than-expected result, Wilders was still on track to gain seats, reconfirming his role as a sharp and persistent thorn in the side of the nation’s mainstream leaders.

Outside Dutch borders, many leaders offered sighs of reliefat the dike that voters may have erected against populist tides.

“Congratulations to the Dutch for stopping the rise of the extreme right,” wrote French Foreign Minister Jean-Marc Ayrault on Twitter. “Willingness to work for a stronger Europe.” His nation faces the first round of a presidential election on April 23.

There, National Front leader Marine Le Pen has vowed to try to lead France out of the European Union if she wins the presidency, a step that would likely shatter the bloc. German leaders also face a challenge as the anti-immigrant Alternative for Germany party stands to capture seats in Parliament.

German Chancellor Angela Merkel also sent a relieved valentine.

Dutch Prime Minister Mark Rutte is greeted by supporters as he arrives to make a speech in The Hague after his election victory. (Carl Court/Getty Images)

“I look forward to continued good cooperation as friends, neighbors, Europeans,” Merkel told Rutte in a phone call, her spokesman said.

Taken together, the initial results appeared to show a nation that agreed that it disliked the current political situation — but diverged sharply about an alternative direction. Turnout was high — more than 80 percent — and there were 28 parties to choose from.

With 84 percent of the voting districts reporting results early Thursday, Rutte’s center-right People’s Party for Freedom and Democracy remained the largest party, but it was on track to lose nearly a quarter of its seats in parliament, forcing the prime minister to form a new, broader coalition across the political spectrum. His coalition partner, the center-left Labor Party, was wiped out as a political force, a punishing blow in response to cooperation with a longtime rival that had a sharply different approach to the core issues of working citizens.

Even as Wilders confronted limits to his ballot-box appeal — he captured about 13 percent of the vote — his agenda-setting power remained evident after many mainstream politicians tacked rightward during the campaign to advocate for stricter limits on immigrants.

“All the politicians of the main parties have been debating his issues, more than they’ve been debating other issues such as climate change,” said Sarah de Lange, a professor of political science at the University of Amsterdam.

Wilders’s Party for Freedom was forecast to build slightly on its current 15 seats in the lower house of parliament, tying it with the centrist Democrats 66 party and the center-right Christian Democratic Appeal. The center-left Green-Left party, led by Jesse Klaver, a 30-year-old upstart who embraced Barack Obama-style campaign tactics, also appeared to do well, potentially quadrupling its seats.

“With Brexit and Trump and with the elections in France and Germany on their way, all those journalists we’ve spoken with in the last weeks wanted to know: Will populism break through in the Netherlands?” Klaver said at a jubilant evening rally. “This is the answer we have for Europe. Populism didn’t break through.”

Still, the likely formation of a broad, weak coalition across the political spectrum could give extra ammunition to Wilders even though he will be barred from power. Rutte has repeatedly said he would not work with the peroxide-haired campaigner. Wilders may be able win more voters in the future by saying that mainstream parties are conniving across political lines to ignore the will of the Dutch people.

But it remained to be seen how enduring the sharp tone on immigrants would be.

Rutte significantly toughened his stance on immigrants during the campaign in a bid to capture Wilders’s supporters, telling immigrants in January to “act normal or go away.”

With many of the prime minister’s potential coalition partners in favor of a more accepting approach to refugees, he may moderate his tone to build partnerships. And Wilders’s underwhelming election-day performance will further ease pressure to take a hard line on immigration.

“The key effect of it is international,” said Cas Mudde, a professor of political science at the University of Georgia who focuses on political extremism in Europe. “It determines what issues we talk about and how we talk about them.”

He said that mainstream Dutch political leaders would probably feel less pressure to take a hard line against immigration and may actually become significantly more moderate depending on the outcome of coalition negotiations.

The tone of the Dutch campaign dispirited some citizens who want a welcoming attitude toward refugees and immigrants.

“They’re not making the point what they want to do. They’re just saying what they’re against,” said Arieke Maljaars, 32, a teacher at an elementary school in the heavily immigrant Schilderswijk area of The Hague, where Turkish kebab stands are close to Surinamese grocery stores. She said she planned to vote for the small, centrist Christian Union party. She said some of her 8- and 9-year-old students, most of whom are immigrants or the children of immigrants, “were really scared.”

“One of them said, ‘Maybe I’ll have to go to Turkey, and I really don’t want to go there.’ For children in the neighborhood, it can feel frightening,” Maljaars said.

Muslim immigrants also said they felt threatened by the message.

“It’s normal that someone thinks about his own country. But don’t do it with discrimination,” said Nawaz Nawaz, 62, who emigrated from Pakistan to The Hague 40 years ago and said he voted for a small party that caters to older voters.

Many Wilders supporters said Wednesday that they resented that refugees who came to their country were provided housing and health care even as Dutch people struggled to make ends meet.

“I understand they don’t have anything, but I have to pay for all that,” said Bep van Beele, 66, who lives in the working-class Duindorp area of The Hague, a bastion of Wilders’s support. “It creates jealousy. There’s not much left for the Dutchman.”

Annabell Van den Berghe in The Hague and Isaac Stanley-Becker in Maastricht contributed to this report.