Leonhard Foeger / Reuters A migrant woman carries a baby as she walks towards the Austrian border from Hegyeshalom, Hungary September 29, 2015.

Hungary’s parliament approved measures on Tuesday to detain asylum seekers for the duration of their application process, and transfer refugees and migrants in the country to repurposed shipping containers for housing.

Human rights groups have blasted the policy as illegal and inhumane, in what they argue is part of Hungary’s continued crackdown on refugees and migrants. These latest measures, they say, mark an escalation of the government’s already draconian measures to deter people from crossing into Hungary.

“Plans to automatically detain some of the world’s most vulnerable people in shipping containers behind razor wire fences, sometimes for months on end, are beyond the pale,” Gauri Van Gulik, Amnesty International’s deputy director for Europe, said in a statement on Tuesday.

Amnesty claims that blanket detentions are in violation of international and EU laws, and such measures should instead be reviewed on a case-by-case basis.

“Detention of asylum-seekers should always be a last measure and should not be applied arbitrarily and without judicial review and access to remedy. Children must never be detained solely on the grounds of their immigration status,” Amnesty stated.

The U.N. refugee agency also voiced its opposition to Hungary’s plan, saying that it was “deeply concerned” about the new law.

“In practice, it means that every asylum-seeker, including children, will be detained in shipping containers surrounded by high razor wire fence at the border for extended periods of time,” the agency said in a statement.

Hungarian parliament approved the plan by a vote of 138-6, with 22 abstentions. It calls for all current and future asylum seekers to be held in detention camps along the border with Serbia. Children traveling with parents, as well as all adult migrants regardless of gender and vulnerability, will be subject to the measures. The only exceptions are for unaccompanied minors below the age of 14.

Laszlo Balogh / Reuters A Hungarian policeman patrols the Hungary-Serbia border, which was recently fortified by a second fence, near the village of Gara, Hungary March 2, 2017.

Hungarian Prime Minister Viktor Orban claimed at a ceremony for hundreds of new border guards on Tuesday that the forced detentions would keep borders safe, and said the country was “under siege” from immigration. Orban has made opposition to immigration a key part of his populist platform, appealing to ethno-nationalist sentiment and calling migration a “poison” for Hungary.

Hungary has long been antagonistic toward European Union asylum policy, and has repeatedly opposed EU attempts to mitigate the migration crisis through refugee resettlement plans. Hungary held a referendum in October of last year in which voters overwhelmingly opposed EU migrant quotas, but the vote was deemed invalid because of the extremely low turnout.

In recent months, Orban has become even more adversarial toward the EU in both his actions and rhetoric. Orban met with Russian President Vladimir Putin early last month and denounced Western sanctions put on Russia. Weeks later, Hungary began construction on a second border fence to keep out migrants in mid-February, which added to the initial barrier it erected in 2015.

Orban also made an inflammatory speech last week in which he told a crowd at the Hungarian Chamber of Commerce and Industry that “ethnic homogeneity” was key for economic success.

“Too much mixing causes problems,” Orban claimed during the speech.