Hungary's parliament has approved the automatic detention of all asylum seekers in container camps on the southern borders, dismissing concerns from human rights groups.
The legislation, approved by a large majority of politicians, was created in response to recent terrorist attacks in Europe carried out by migrants, the hardline prime minister, Viktor Orbán, has said.
Speaking at a swearing-in of the latest contingent of 450 new border police in Budapest on Tuesday, Orbán 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.
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."
All asylum seekers entering Hungary, as well as those already in the country, will be detained or moved to the container camps. They will not be able to move around Hungary or leave the country while their applications are processed, unless they are going back over the border to Serbia.
"In the future, illegal immigrants must wait for the verdict on their asylum case in designated transit zones at the border," said the bill, published on the parliament website.
It reinstated Hungary's practice of detaining asylum applicants, which it suspended in 2013 under pressure from the European Union, the UN refugee agency and the European court of human rights.
Amnesty International said 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 bill is the latest element of a tough anti-immigration stance by Orbán, which has long been criticised by rights groups as inhumane.
As well as building militarised razor-wire fences on its borders with Serbia and Croatia in 2015, Hungary has handed thousands of asylum seekers 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".
According to the government, 1,004 people have applied for asylum in Hungary so far this year. Officials say the new border camps will comprise converted shipping containers built onto existing "transit zones" erected in 2015 at the southern border with Serbia.
The government says asylum seekers have been abusing the previous rules and leaving Hungary before a verdict is reached, exposing the bloc to the risk of terror attacks.
"Any legal regulation that facilitates terror acts must be changed in the interests of our own self-defence," Orbán said in January. The 53-year-old Orbán, a strong admirer of the 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.
Another change in law last year enabled police to physically push back to Serbia anyone caught in Hungarian territory within five miles (8km) of the border.
In Monday the interior ministry was forced to defend police against accusations of brutality against refugees and migrants, made in a newspaper article by medical aid organisation Médecins Sans Frontičres . The ministry "repeatedly and categorically rejects the unverified allegations", said a statement.(Source: The Guardian)