The Austrian parliament on Wednesday adopted one of Europe's toughest asylum laws, as the country's political leaders struggle to halt the surging far-right which is leading in presidential polls.
The hotly-disputed bill, which passed by 98 votes to 67, allows the government to declare a "state of emergency" if migrant numbers suddenly rise and reject most asylum seekers directly at the border, including those from war-torn countries like Syria.
Opposition parties and rights groups have slammed the legislation, with the UN's refugee agency warning that it "removes a centrepiece of refugee protection".
But Interior Minister Wolfgang Sobotka insisted Austria had no other choice as long as "so many other European Union members fail to do their part" to stop the influx.
"We cannot shoulder the whole world's burden," he said.
Wedged between Europe's two main refugee routes - the Balkans and Italy -- Austria received around 90,000 asylum requests in 2015, the second-highest in the bloc on a per capita basis.
More than a million people, primarily from Syria, Iraq and Afghanistan, landed in Europe last year, triggering the continent's worst migration crisis since the aftermath of World War II.
Many braved a short but dangerous sea journey from Turkey to Greece, before trekking up through the Balkans toward western and northern Europe.
To reduce the flow, the EU recently struck a controversial deal with Ankara, under which all irregular migrants reaching Greece after March 20 will be returned to Turkey.
Although the pact has led to a sharp drop in arrivals, the International Organisation for Migration last week warned that the numbers were starting to rise again.
The crisis has boosted populist fringe parties across Europe, pressuring traditionally centrist governments to adopt a much firmer stance on migrants.
Under Austria's new law, the government can now declare an emergency if the migrant flow threatens "national security".
Border authorities will then only grant access to refugees facing safety threats in a neighbouring transit country or whose relatives are already in Austria. Some groups including minors and pregnant women will be exempt from the rule.
The "special measures" will also force migrants to request asylum directly at the border in yet-to-be-built registration centres, where they may be held for up to 120 hours while their application is being checked.
The restrictions are similar to tough rules introduced by the right-wing government in neighbouring Hungary last year.
In addition, MPs also voted to restrict existing asylum laws by placing limits on the length of asylum granted to migrants and making it harder for their families to join them.
"These are extremely dangerous tools that are being sharpened here, especially if they fall into the wrong hands," said the leader of the small NEOS opposition party, Mathias Strolz.
Shortly before the vote, a group of protesters threw leaflets from the parliament's upper gallery reading "Don't walk over dead bodies, it won't keep you afloat".
The vote comes after the candidate of the far-right Freedom Party (FPOe), Norbert Hofer, sent shock waves through the political establishment by winning the first round of the presidential election on Sunday.
The two candidates of the ruling centrist coalition failed to even make it into the runoff on May 22.
The FPOe also looks set to do well in the next scheduled general election in 2018.
Trying to stem voter desertion to the far-right, Austria erected border fences and introduced an annual cap on asylum-seekers.
It also pressured other countries along the Balkan trail to close their frontiers earlier this year, effectively shutting the route to migrants.
The clampdown has left some 54,000 migrants stranded in Greece and pushed people smugglers to seek out new routes into Europe.
More than 26,000 migrants have landed on Italy's shores so far this year after setting off from Libya.
The arrivals have prompted Austria to announce plans to reinstate border controls -- including a 370-metre (1,200-foot) fence -- at the Brenner pass in the Alps, a key transport corridor between northern and southern Europe.
The move has sparked protests at the checkpoint in recent weeks and drawn strong condemnation from Italy.
"We're very far from an invasion," Foreign Affairs Minister Paolo Gentiloni told Austrian newspaper Die Presse on Wednesday.