European leaders have welcomed the result of the Netherlands election, which saw the anti-immigration party of Geert Wilders fail to become the largest in parliament.
Prime Minister Mark Rutte’s centre-right VVD won by some margin.
For Francois Hollande of France it was a “clear victory against extremism”, while German Chancellor Angela Merkel hailed a “good day for democracy”.
The vote was closely watched ahead of elections in France and Germany.
The Netherlands was seen by many as a bellwether for how populist parties will perform in those polls.
In contrast, Turkey, currently embroiled in a bitter dispute with the Netherlands, had little positive to say.
“Hey Rutte, you may have won the election as first party, but you have lost a friend like Turkey,” President Recep Tayyip Erdogan told a rally.
Celebrating victory, Mr Rutte said the Dutch people had rejected “the wrong kind of populism”.
“The Netherlands said ‘Whoa!'” he declared.
With all but two vote counts complete, the prime minister’s party has won 33 out of 150 seats, a loss of eight seats from the previous parliament.
Mr Wilders’ Freedom party was in second place on 20 seats, a gain of five, with the Christian Democrats (CDA) and the liberal D66 party close behind with 19 seats each.
The Green-Left party also did well, winning 14 seats, an increase of 10.
The Labour Party (PvdA), the junior party in the governing coalition, suffered a historic defeat by winning only nine seats, a loss of 29.
Turnout was 80.2%, which analysts say may have benefited pro-EU and liberal parties. The number of voters was a record 10.3 million, according to public broadcaster NOS.
France goes to the polls next month to elect a new president, with the far right National Front forecast to increase its vote dramatically.
In Germany, the populist Alternative for Germany (AfD) may win seats in parliament for the first time in September’s general election.
Mr Rutte had already spoken of the election as a quarter-final against populism ahead of the French and German polls.
Weeks before the election, opinion polls forecast the PVV winning the biggest number of seats but Mr Wilders’ lead vanished as the vote drew near.
He had pledged to take the Netherlands out of the EU, close all mosques and ban the Koran.
He warned that Mr Rutte had “not seen the last” of him.
“It’s not the 30 seats I hoped for but we have gained seats,” he added. “This patriotic spring will happen.”
Defeated Labour leader Lodewijk Asscher agreed that “populism is not over”. The anger and insecurity of voters was reflected in the increased vote for Mr Wilders and the wider fragmentation of Dutch politics, he said.
In reality his party gained five seats and, as he pointed out, it is now the second biggest in parliament not the third.
But his decline in the polls was clear and it is being seen partly as self-inflicted.
He refused to take part in two TV debates because of scathing comments about him made by his brother, Paul, on the same TV channel.
But it was as much Mark Rutte’s success as Geert Wilders’ failure. The prime minister’s response to Nazi slurs against the Dutch made by the Turkish president was praised across the political spectrum.
As parliamentary seats are allocated in exact proportion to a party’s vote share, the VVD will need to go into coalition with three other parties.
If recent Dutch history teaches you anything about coalition-building, it is that it will not happen overnight. In 2012 it took 54 days, and that was relatively fast as it involved just two parties.
Mr Rutte has spoken of a “zero chance” of working with Mr Wilders’ PVV, and will look instead to the Christian Democrats and D66, which are both pro-EU. It would still be several seats short of forming a government and would need further support from a fourth party.
The VVD has much in common with the liberal D66 in backing progressive policies on soft drugs and assisted dying. But that would be resisted by both parties with a Christian background. The path to a coalition will not be easy.