Austria has elected a 72-year-old former leader of the Greens party to be its next President, narrowly avoiding becoming the first country in the European Union to vote in a far-right candidate as head of state.
After an election on Sunday that was too close to call, Austrian officials spent most of Monday counting hundreds of thousands of postal ballots which ended up vaulting Alexander van der Bellen past Freedom Party rival Norbert Hofer and into the ceremonial post of President.
The Interior Ministry gave van der Bellen 50.3 percent of the vote, compared to 49.7 percent for Hofer, who had run on an anti-immigration platform.
Hofer conceded defeat in a post on his Facebook page, thanking his supporters and telling them not to be despondent.
His defeat averts an embarrassing setback for Europe's political establishment, which is increasingly under threat from populist parties, which have profited from concerns about the region's refugee crisis and years of weak growth and high unemployment.
"It's a relief to see the Austrians reject populism and extremism," French Prime Minister Manuel Valls tweeted.
Austria is a relatively prosperous country, but has been at the centre of a record influx of migrants from the Middle East, fanning public resentment towards the two centrist parties, which have dominated politics since the end of World War II.
The vote in Austria, a country of 8.5 million people, had unsettled leaders elsewhere in Europe, particularly in neighbour Germany where a new anti-immigration party, the Alternative for Germany (AfD), is on the rise.
In France, the National Front of Marine Le Pen is leading in polls ahead of a presidential election next year.
Across the Channel, the UK Independence Party is campaigning for Britain to leave the EU in a referendum on June 23.
Hofer described himself as a centre-right politician but his party has its roots in Austria's Nazi past, a history the country has not confronted as openly as Germany.