Budapest: Hungary's parliament on Tuesday approved the automatic detention of all asylum-seekers in container camps at the borders, sparking "deep concern" at the UN's refugee agency.
The legislation, approved by a large majority of lawmakers, is in response to recent terror attacks in Europe carried out by migrants, according to hardline Prime Minister Viktor Orban.
Speaking at a swearing-in of the latest contingent of some 450 new border police in Budapest on Tuesday, Orban called immigration "the Trojan horse of terrorism".
"If the world sees that we can defend our borders... then no one will try to come to Hungary illegally," he added.
Under the new measures, all asylum-seekers entering Hungary as well as those currently in the country will be confined in the container camps while their applications are processed.
Anyone who passed through a "safe third country" including Serbia will be rejected, and any appeals against rejections will be fast-tracked into a three-day procedure.
Migrants whose applications are rejected may have to cover the costs of their own detention.
Hungary previously systematically detained all asylum applicants but suspended the practice in 2013 under pressure from Brussels, the UN refugee agency and the European Court of Human Rights.
The UNHCR said the legislation "violates Hungary's obligations under international and EU laws, and will have a terrible physical and psychological impact on women, children and men who have already greatly suffered."
The local branch of the Helsinki Committee said it was the "last stepping stone in completely disregarding (Hungary's) asylum obligations under EU and international law and trampling the rights of asylum seekers."
Amnesty International said in a statement last month that the new rules "disregard EU guiding principles that it is forbidden to detain someone on the basis that they have claimed asylum".
The government says the new camps will comprise converted shipping containers built onto existing "transit zones" erected in 2015 at the southern border with Serbia.
It says the new legislation will protect both Hungarian and EU citizens, with migrants abusing the previous rules and leaving Hungary before a verdict is reached, exposing the bloc to the risk of terror attacks.
EU member Hungary's border is also an outside border of Europe's border-free Schengen zone.
As well as building militarised razor wire fences on its borders with Serbia and Croatia in 2015, Hungary has handed thousands of migrants expulsion orders for "illegal border-crossing" and even jailed some.
It has also gradually been closing down its network of refugee camps, while allowing only a trickle of asylum-seekers into the existing transit zones.
Hungarian prisoners are also building a second "smart fence" complete with night cameras and heat and movement sensors.
At the height of Europe's migrant crisis in 2015, over 400,000 people, many fleeing the Syrian civil war, passed through Hungary on their way to western Europe.
This has since slowed dramatically, with 1,004 people applying for asylum in Hungary so far this year.
But Orban said Tuesday that this was just a temporary lull.
“The pressure on the border will not end in coming years, as there are still millions of people preparing to step out on the road in hope of a better life," he said.
The 53-year-old Orban, a strong admirer of US President Donald Trump, has long taken a hard line on immigration.
He has said that a large influx of Muslim migrants into Europe poses a security risk and endangers the continent's Christian culture and identity.
Budapest has refused to take part in an EU scheme to share around the EU the hundreds of thousands of migrants who entered the bloc in recent years.
"Those readying for the journey do not want to live according to our ways and culture but according to their own -- only with a European quality of life," he said Tuesday....