Dutch center-right Prime Minister Mark Rutte fought off the challenge of anti-Islam and anti-EU rival Geert Wilders to score an election victory that was hailed across Europe on Thursday by governments facing a rising wave of nationalism.
The euro gained as the results of Wednesday's vote showed a clear win for Rutte, albeit with fewer seats than in the last parliament.
He declared it an "evening in which the Netherlands, after Brexit, after the American elections, said 'stop' to the wrong kind of populism."
The result was a disappointment for Wilders, who had led in opinion polls until late in the campaign and had hoped to pull off an anti-establishment triumph in the first of three key elections in the European Union this year.
A win for him would have been seen as a boost for French far-right leader Marine Le Pen, running second in opinion polls before a presidential election in April and May, and for populist parties elsewhere that want to curb immigration and weaken or break up the European Union.
The sense of relief among European leaders was palpable.
"The Netherlands are our partners, friends, neighbours. Therefore I was very happy that a high turnout led to a very pro-European result, a clear signal," said German Chancellor Angela Merkel, who will run for re-election in September.
French presidential candidate Emmanuel Macron, expected to face Le Pen in a two-way run-off on May 7, said: "The Netherlands is showing us that a breakthrough for the extreme right is not a foregone conclusion and that progressives are gaining momentum."
The risk premium demanded by investors to hold French government bonds rather than safe-haven German bunds sank in early trade to its lowest level in two weeks, although the move proved temporary.
European shares hit their highest level in 15 months, encouraged partly by the Dutch result but also by the dovish tone from the Federal Reserve that accompanied Wednesday's U.S. interest rate rise.
Gift from Turkey
With 97 percent of votes counted, Rutte's VVD Party had won 33 of parliament's 150 seats, down from 41 at the last vote in 2012. Wilders was second with 20, and the CDA and centrist Democrats 66 tied for third with 19 each, data provided by the ANP news agency showed.
Rutte is now virtually guaranteed a third term, leading a government that can be expected to continue tightening immigration policy in the Netherlands, already among the strictest in the EU.
A number of parties including Rutte's and the third-placed Christian Democrats (CDA), have already adopted most of Wilders' anti-immigration platform, if not his fiery anti-Islam rhetoric.
With his strong second-place finish, Wilders warned Rutte that he had not seen the last of his Party for Freedom. He added that he wanted to participate in coalition talks, even though mainstream parties have ruled out working with him.
"We were the 3rd largest party of the Netherlands.
Now we are the 2nd largest party. Next time we will be number 1," Wilders said.
Rutte got a last-minute boost from a diplomatic row with Turkey, which allowed him to take a tough line on a majority Muslim country during an election campaign in which immigration and integration have been key issues.
"Rutte profited from moving to the right, but also from Wilders having radicalized a lot over the last years and being invisible in the campaign," said Cas Muddle, associate professor at the University of Georgia, referring to Wilders' decision to forego election debates until the final week.
"On top of that, Turkish President (Tayyip) Erdogan gave (Rutte) a beautiful gift."
Turkey has been locked in a deepening row with the Netherlands after the Dutch barred Turkish ministers from speaking to rallies of overseas Turks.
Turkey's foreign minister said the views of Wilders - who wants to close all mosques and ban the Koran - were shared by rival parties and were pushing Europe towards "wars of religion".
Focus next on Le Pen
With 13 parties set to enter a fragmented parliament under the proportional Dutch voting system, it will likely take months for Rutte to negotiate a ruling coalition. He will need at least three other parties to reach a majority.
At 80 percent, turnout was the highest in a decade in an election that was a test of whether the Dutch wanted to end decades of liberalism and choose a nationalist, anti-immigrant path by voting for Wilders and his promise to "de-Islamicise" the Netherlands and quit the EU.
Outgoing French President Francois Hollande called the result a "clear victory against extremism", and European Commission President Jean-Claude Juncker called it "an inspiration for many".
France's Foreign Minister Jean-Marc Ayrault tweeted: "Congratulations to the Dutch for stemming the rise of the far-right."
But Mabel Berezin, professor of sociology at Cornell University in the United States, said defeat for Wilders, who has been in parliament for nearly two decades, should not be considered a sign that European populism is waning.
"The real bellwether election will be Marine Le Pen's quest for the French presidency, starting April 23 – that is where the populist action is and that is what we should be focusing upon," she said.
While Rutte overtook Wilders in the closing stages of the campaign, years of austerity pushed down his share of the vote. His junior partner in the outgoing coalition, Labour, suffered its worst ever result, winning just nine seats, down from 38 last time.
Wilders' PVV will have a third more seats in parliament than before, but is still well below a 2010 high of 24 seats. Support for the two most pro-EU parties, the progressive D66 and GreenLeft, was way up.
Denk, a party supported by Dutch Turks, looked set to win three seats and become the first ever ethnic minority party in parliament, in a possible sign of deepening ethnic division.
An official, final result will be announced by the Dutch Electoral Council on March 21.