A Hungarian police officer stands guard at Serbia's border with Hungary near a makeshift camp for migrants in Horgos, Serbia, Wednesday, Feb. 8, 2017. (AP Photo/Darko Vojinovic)

Being called Europe’s Donald Trump might be perceived more as praise than criticism by Hungarian Prime Minister Viktor Orban. But a Tuesday parliamentary vote to automatically detain all asylum seekers was astonishing even by Hungarian standards — taking a nation already known for its tough stance on refugees into uncharted legal territory and risking a serious confrontation with the European Union.

The new law, which is expected to take effect later this month, will make it mandatory for authorities to detain all asylum seekers until their applications are reviewed, a process that often takes months. The law uses the term “assigned residency” to describe the practice, but it is widely considered to essentially constitute detention.

Although other nations also restrict the movement of some migrants for security reasons, Hungary would be the only European member state with such expansive measures, targeting all asylum seekers over the age of 14. In theory, the bill can still be vetoed by the Hungarian president, but such a step is considered unlikely by experts.

“In practice, this 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,“ said Cécile Pouilly, a spokeswoman for the U.N. High Commissioner for Refugees (UNHCR). The law will apply to both newly arrived asylum seekers and those who are currently waiting for their applications to be processed.

“It is the newest step of a very aggressive crackdown on refugees in Hungary,” Todor Gardos, a Hungary expert with the human rights group Amnesty International, told The Washington Post on Tuesday. “Besides the fact that asylum seekers are unable to challenge the detention and that according to human rights law they cannot be detained if other measures are available, the Hungarian camps are also hardly equipped for housing hundreds of people over a longer period of time.“

“Theoretically, the bill would allow authorities to detain asylum seekers indefinitely,” said Gardos.

Amnesty International and the U.N. refugee agency, among other organizations advocating on behalf of asylum seekers, believe that the Hungarian legislation violates human rights law. “Alternatives to detention should always be considered first,” said Pouilly. Amnesty International on Tuesday repeated its earlier demands for an E.U. inquiry whether the Eastern European nation complies with the rule of law.

In Hungary, such criticism is unlikely to resonate strongly, however. Hostility toward asylum seekers there has been rising steadily for years. In the past decade, the number of Hungarians opposed to accepting any asylum seekers has more than doubled, reaching 53 percent last year.

Hungary_new

Human rights organizations accuse Orban, the prime minister, of deliberately fueling hatred against newcomers. In the past, he has depicted himself as one of the only European leaders willing to defend the continent's Christians. In September 2015, Orban said that Muslims were threatening Europe's Christian identity, framing the issue as a clash between different civilizations.

Such rhetoric has turned Hungary into what critics describe as a hostile environment for Muslim migrants. Human rights organizations allege that Hungary has abused anti-terrorism laws to sentence individuals accused of rioting in refugee camps. In February, Hungarian leaders watched silently as a village declared war on Muslim immigration by banning hijabs and other head coverings worn by Muslim women, as well as mosques and the call to prayer.

Read more:

A Hungarian village declared ‘war’ on Muslim immigration. Few objected.

Hungary built a razor-wire fence to keep refugees out. Now, it’s desperate for migrants.

He says he wanted to help his family escape war. But Hungary thinks he is a terrorist.