BUDAPEST, Hungary (AP) — Hungary’s practice of keeping asylum seekers in a closed transit zone on the border with Serbia qualifies as “unlawful detention,” according to an nonbinding opinion issued Thursday by a senior official at the European Union’s highest court.

Over the past few years, Hungary has introduced increasingly tough anti-immigration measures and built transit zones made out of shipping containers in the wake of the 2015 migration crisis, when some 400,000 people passed through the country on their way to Western Europe.

Hungarian Prime Minister Viktor Orban boasted recently that “there is not a single Muslim migrant in Hungary.”

Priit Pikamae, Advocate General of the Court of Justice of the European Union, was critical Thursday of several anti-immigration rules applied by Hungary, including one which makes it possible to reject asylum applications from anyone arriving from Serbia.

Because Serbia refuses to take back asylum seekers rejected by Hungary, Hungary often seeks to have them deported to their countries of origin instead of judging their claims on merit.

Pikamae also found that asylum seekers in the transit zone are in “a situation of isolation and a high degree of restriction of the freedom of movement … to such an extent that is constitutes detention.”

WATCH: Why getting the U.S. back to normal in the next couple months is a ‘fantasy’

Since Hungary has not complied with European directives for the detention of asylum seekers, “the detention of the asylum seekers in question must be classified as unlawful.”

Pikmae noted that while a recent decision by the European Court of Human Rights found that the detention of asylum seekers did not constitute a deprivation of the “right to liberty and security,” he recommended that the Court of Justice of the European Union “offer a higher level of protection” to asylum seekers in the Hungarian transit zone than what is guaranteed by the European Convention for the Protection of Human Rights.

The EU’s Court of Justice, based in Luxembourg, is beginning its deliberations over the case. While it is not forced to follow the opinion of the Advocate General, the court’s rulings are often similar to the opinions.

Reacting to Thursday’s opinion, Hungary’s justice minister insisted that the country’s “regulations and practices comply with EU and international law.”

“The Hungarian government will continue to protect the borders of Hungary and Europe and will do its utmost to prevent the formation of international migrant corridors,” Judit Varga said in a Facebook post.

A lawyer with the Hungarian Helsinki Committee, which advocates for the rights of asylum seekers and has been a frequent target of government smear campaigns, welcomed Pikmae’s recommendations.

The opinion “gives hope to people who have been detained in the transit zones for a very long time, half of whom are children, that Hungary will not only examine their asylum applications on their merit but that they also may regain their liberty,” Barbara Poharnok said in a statement.