He didn't win. But a populist candidate representing the far-right Freedom Party in Austria's presidential election, Norbert Hofer, came very, very close.

As of Sunday night, Hofer was in the lead, barely. But then, about 700,000 mail-in ballots were counted. They gave the independent candidate, former Green Party leader Alexander Van der Bellen, a narrow come-from-behind victory. In the end, he defeated Hofer 50.3 percent to 49.7 percent — a difference of about 30,000 votes.

“It was a very exciting election night,” says Melanie Sully, who has been watching the numbers closely. Sully is the head of Go-Governance, an independent institute based in Vienna that studies and promotes democratic governance. 

“There's a lot of relief on one side obviously and some disappointment on the other. The country is basically split into two kinds of camps, if you like, because these two candidates were so different, they had such a different conception of what the office of the federal president would be, and also very, very different political views.”

Austrian presidential vote reveals a Europe divided says @BBCkatyaadler https://t.co/eaHpTCyZWz pic.twitter.com/oHPdE29FhL

— BBC News (World) (@BBCWorld) May 23, 2016

Hofer has accepted defeat. The challenge now is for Austria’s president-elect to unite a heavily divided country. That's not an easy task considering that Europe's ongoing refugee crisis was at the heart of Austria’s tight election.

Hofer took an anti-immigration stance, calling for EU borders to be defended and pledging to protect Austria's own borders with some kind of "barrier" if necessary. Hofer drew large support from rural towns that were shocked by the arrival of refugees and migrants last year.

“There were so many people that came last year across the borders without any documentation, without registration, and people just didn't know who they were or where they came,” says Sully, “and in fact didn’t even know if they were genuine refugees.”  

On the other hand, Van der Bellen's campaign embraced more open borders in a way that resonated with residents living in the bigger cities. 

“They were very open to refugees coming," Sully explains, "and very concerned that people should not be divided amongst themselves and that conflict could be kept to a minimum, and that what you have to do is think about how to prepare them for a life, and make sure they will be well integrated into the community.”

#Austria has avoided having a gun-toting, anti-immigration and Eurosceptic head of state – but only justhttps://t.co/whOKRjCeO2

— Channel 4 News (@Channel4News) 23 May 2016

So is there a message for American voters coming out of this squeaker of an election in which a populist politician took a hard line on immigration and called for building walls to keep migrants out? Is it a cautionary tale for US Democrats worried about Donald Trump’s appeal?

“I think the message is ... that you really have to listen to the concerns of ordinary people, people who voted for Hofer because they thought he was listening to them, not just talk all the time but actually do something. Listening is also part of politics. Find out what their real concerns are. Offer something positive without being populist, that’s really difficult, but try to make sure that people are on board with you rather than racing ahead and just hoping they'll trail along.”

From PRI's The World ©2016 PRI