VIENNA (Reuters) - Austria’s interior minister threatened on Wednesday to sue Hungary if it refused to take back migrants crossing their shared border, in an escalation of tensions over immigration ahead of next month’s presidential election.

A migrant carries a child on his shoulders as they walk to cross the border with Austria in Hegyeshalom, Hungary, September 28, 2015. REUTERS/Leonhard Foeger

Pressured by a surge in support for the far-right Freedom Party (FPO), Austria’s government has repeatedly accused Hungary of letting migrants enter its territory in defiance of European Union rules that asylum seekers must stay in the first country they enter in the bloc.

Hungary, which is preparing for a referendum on whether to accept an EU-wide asylum quota, has countered that most refugees enter its territory from other EU states, notably Italy and Greece, in a growing European blame game.

“States or groups of states that permanently break the law have to expect legal consequences,” Interior Minister Wolfgang Sobotka told ORF radio, responding to a question on Hungary’s refusal to give ground.

“In that case, the (Austrian) republic must sue. The republic must see that the European Union acts according to the law, full stop,” he added, without specifying what legal process he was considering.

Budapest has built a fence along its border with non-EU member Serbia to stem the flow of hundreds of thousands of people, many of them fleeing violence in the Middle East and North Africa. However, both Hungary and Austria said earlier this month the situation was now broadly under control.

“IRRESPONSIBLE CONDUCT”

A Hungarian government spokesman dismissed Sobotka’s call in an emailed statement, saying the vast majority of migrants had arrived in other EU states first.

“Hungary cannot and will not take responsibility for, and suffer the consequences of, the irresponsible conduct of other member states - Austria, Germany - which expressly suggested ignoring the rules, or for other states - Greece - that neglected to do their job,” the spokesman said.

Many migrants arriving in central Europe first entered the EU via the Greek islands from Turkey.

Last autumn Germany and Austria initially welcomed large numbers of refugees from the Middle East and Afghanistan. But Vienna started to toughen its asylum rules this year and imposed an annual limit on the number of asylum requests it accepts.

Those steps, widely criticised by human rights groups and the European Union, came after the anti-immigrant FPO surged past the ruling centrist parties in opinion polls.

FPO candidate Norbert Hofer hopes to become Europe’s first far-right head of state after Austria’s presidential election on Oct. 2, the same day as the Hungarian referendum.

Late on Tuesday Austria’s government backed draft emergency measures that would allow it to turn migrants away directly at the border once the annual threshold of 37,500 was exceeded.

The decree said exceeding the asylum limit this year could endanger Austria’s security by putting pressure on public services and leading to increased crime.

U.N. refugee agency UNHCR expressed concern over the move.

“The planned emergency decree would break a taboo and mean a departure from refugee protection in Austria,” UNHCR Austrian director Christoph Pinter said in a statement.

The measures will now be subjected to four weeks of discussion before taking effect.