The Austrian parliament has adopted one of Europe’s most restrictive refugee laws, allowing the government to declare a state of emergency if the number of migrants threatens “national security.” It may also directly reject refugees at the border.

The toughest-ever bill, passed by 98 to 67 on Wednesday, allows the Austrian government to declare a state of emergency if the number of migrants unexpectedly goes up, thereby posing “a threat to national security.”

Depending on the situation, the state of emergency could be extended for three more six-month-long terms, according to Deutsche Welle.

Under the new law, border control officers would also be given the right to refuse entry to nearly all migrants, with only a few exceptions for those facing safety threats in a neighboring transit country or those who already have relatives in Austria.

Some other vulnerable groups like unaccompanied minors and pregnant women would be kept exempt from the harsh rule.

The special measures will also oblige migrants to file their asylum applications directly at the border in registration centers which are yet to be built, contrary to a previous practice of letting the refugees into the country. They may be held for up to 120 hours while their application is being verified, local press reported.

Austrian MPs also voted to restrict existing refugee laws by limiting the number of years a refugee could stay in Austria.

Local media reported that the government is considering erecting protective a fence at its mountain border with Italy in case of an upsurge in migrant numbers.

The controversial EU-Turkey deal, although being fragile, has effectively sealed the so-called “Balkan route,” the gateway through which most refugees arrive in Europe after a dangerous trip via the Aegean.

It also pushed people smugglers to seek out new lanes into Europe, including via Italy, which has seen thousands of migrants land on its shores after setting off from Libya.

The surge in arrivals in neighboring Italy has prompted Austria to announce plans to re-introduce border controls, including a 370-meter fence, at the Brenner pass in the Alps, a key transport corridor between northern and southern Europe.

Some observers suggest that the government’s harsh measures can be explained by the skyrocketing popularity of the far-right Freedom Party (FPO), whose candidate Norbert Hofer decisively outscored his centrist rivals earlier this week in the first round of the presidential vote.

Rights groups and opposition parties have blasted the hardline measures as violating international human rights norms. However, Interior Minister Wolfgang Sobotka insisted that Austria had no other option as long as "so many other European Union members fail to do their part" to stop the heavy influx of refugees.

"We cannot shoulder the whole world's burden," he said.

The CEO of the Vienna Center for Societal Security Research said that the new legislation is no more than a “short-sighted reaction” to the recent election results and will not be any help in terms of the migrant crisis.

“The Austrians at the moment are following a very short-sighted populist sentiment… we had the election recently and there was a move towards rightwing populists, and this kind of legislation is simply a reaction to that. But it will not be effective, and it will not solve the problem, and it will also have a negative impact on the overall European strategy to handle this problem,” Reinhard Kreissl told RT.

The creation of the fence on Italy’s border is not a solution either and is “completely irrational”, he said. “The Brenner Pass ... [has] a high symbolic value because it is the main entrance to Austria… and building a fence there is a symbolic action. It doesn’t solve any problem in this area”.

He noted that the measures which Austria is seeking to impose are simply a result of the EU’s “very egoistic and nationalistic way of thinking” which are “counterproductive to the whole European idea.”