A leftwing independent candidate has narrowly prevented Austria from becoming the first EU country to elect a far-right head of state after a knife-edge contest ended with his opponent conceding defeat.

Alexander Van der Bellen – a retired economics professor backed by the Green party defeated Norbert Hofer of the anti-immigrant Eurosceptic Freedom party – a day after polling closed and only once more than 700,000 postal ballots – about 10% of available votes – were taken into account.

The Austrian presidency is a largely ceremonial role but the outcome became hugely symbolic.

Mirroring the rise of populist parties across Europe the Freedom party exploited anti-EU and anti-immigrant sentiment in the wake of the continent’s refugee crisis and despite Hofer’s narrow defeat the election has left a deep split over the direction Austria should now take.

The Austrian interior ministry confirmed that after postal votes were counted Hofer’s final score was 49.7% against 50.3% for Van der Bellen – the son of two refugees.