Hungary's parliament approved Tuesday the systematic detention of all asylum-seekers in container camps, in a move that Prime Minister Viktor Orban said will make all of Europe safer from terror attacks.
Calling immigration the "Trojan Horse of terrorism," Orban said: "If the world sees that we can defend our borders ... then no one will try to come to Hungary illegally."
The legislation will see asylum-seekers entering Hungary as well as those currently in the country confined in camps at Hungary's southern borders while their applications are processed.
Anyone who passed through a "safe third country," including the main entry point Serbia, will be refused. Appeals against rejections will be fast-tracked in three days.
Migrants whose applications are unsuccessful may also have to cover the costs of their own detention. Unaccompanied minors under 14 will be placed in care as before.
European Union member Hungary previously systematically detained all asylum applicants but suspended the practice in 2013 under pressure from Brussels, the United Nations refugee agency and the European Court of Human Rights.
The UNHCR said Tuesday that the new legislation "will have a terrible physical and psychological impact on women, children and men who have already greatly suffered."
The Hungarian 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."
"We are urging the EU to step up and show Hungary that such illegal and deeply inhumane measures have consequences," Amnesty International said.
The Tunisian suspect in the Dec. 19 truck attack on a Berlin Christmas market that left 12 people dead was an asylum-seeker whose application had been refused.
But most other recent attacks in Europe were carried out by people who were born and/or grew up in Europe. Some of those in the 2015 Paris attacks had however posed as refugees.
Hungary's government says the new camps will comprise converted shipping containers built onto existing "transit zones" erected in 2015 at the southern border with Serbia.
Hungary's border is also an external frontier 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 this year and 105 people crossing the border illegally, according to the government.
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 plan 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," Orban said Tuesday.
By AFP's Peter Murphy in Budapest, Hungary.