VIENNA (Reuters) - Austria’s presidential election runoff must be held again, the Constitutional Court ruled on Friday, handing the Freedom Party’s narrowly defeated candidate another chance to become the first far-right head of state in the European Union.

Presidential candidates Alexander Van der Bellen (R) and Norbert Hofer react during a TV debate in Vienna, Austria, April 24, 2016. REUTERS/Heinz-Peter Bader

The verdict comes a week after Britain delighted anti-EU groups by voting to leave the bloc. Concerns about immigration and jobs featured prominently in that referendum, as they did in Austria’s knife-edge election.

Norbert Hofer of the anti-immigration and anti-EU Freedom Party (FPO) lost the May 22 vote to former Greens leader Alexander Van der Bellen by less than one percentage point, or around 31,000 votes, in the race for what is largely a ceremonial position.

The court found more than twice that number of postal ballots had been affected by breaches of the electoral code, forcing it to order a re-run.

Irregularities included ballots being processed before the official start of the count the morning after the election, and counts being carried out in the absence of party observers, often because officials were racing to provide a result quickly.

Ruling on a challenge brought by FPO leader Heinz-Christian Strache, the court found no proof that the result had been manipulated, but the possibility that it might have been affected was enough for a challenge to succeed.

The re-run will reopen a debate that split Austria almost evenly, pitting town against country, and blue-collar workers worried about immigration and falling living standards against the more highly educated.

How the outcome might change in a European political climate colored by the Brexit vote is unclear. Widespread frustration with traditional parties of power has been a feature of both votes, and fueled support for anti-immigration groups.

Austria was swept up in Europe’s migration crisis last autumn when it and Germany opened their borders to hundreds of thousands of people fleeing war and poverty in the Middle East and elsewhere, only to reverse course as public opinion turned.

Hofer’s near-victory was widely seen as part of a rising tide of populism that has since reached Britain. The Brexit vote could buoy support for Hofer - or the economic fallout, including a sharp drop in sterling, could undermine him.

“Brexit is a current issue. It will still be a current issue in the autumn,” Van der Bellen, a chain-smoking 72-year-old, told a news conference.

The irregularities that have come to light during testimony to the Constitutional Court have dismayed the Austrian public.

“There was sloppiness,” Interior Minister Wolfgang Sobotka, whose ministry oversees elections and was accused by several witnesses of putting pressure on officials to provide a rapid count, told reporters after the verdict.

The centrist coalition government must now set a date for the re-run. President Heinz Fischer, whose term runs out on July 8, has said it will most likely be in the autumn.

In the meantime, the position will be held by the three presidents of the lower house of parliament - one of whom is Hofer.

Strache said he was satisfied by the ruling.

“There is no cause to celebrate and no cause for alarm but there is cause to recognize how quickly, how thoroughly and transparently my challenge was seen, verified and in the end ruled on,” he told a news conference.

Marine Le Pen, leader of France’s National Front, an ally of the Freedom Party, was less restrained.

“After the happy victory of Brexit in the United Kingdom and the rise of euroskepticism in Italy, Austria too has the opportunity to return to the path of freedom and national pride,” she said in a statement.