The EU's top court ruled Tuesday that states can deny short-term humanitarian visas to people trying to enter to claim asylum, in a case of a Syrian family trying to come to Belgium.
The decision by the Luxembourg-based European Court of Justice's decision was seen as a test case for EU countries facing a surge in refugees in the past two years, mainly from Syria's civil war.
In a surprise judgment, the court ruled against the family from the besieged city of Aleppo who had applied for the humanitarian visas at the Belgian embassy in the Lebanese capital Beirut last October.
"Yesss! We won!" Belgium's Immigration Minister Theo Francken tweeted after having argued that an unfavorable ruling would have opened the gates to uncontrolled immigration.
The court went against an earlier recommendation by its chief lawyer that the family ran the risk of inhumane treatment if they stayed in Syria.
"Member States are not required, under EU law, to grant a humanitarian visa to persons who wish to enter their territory with a view to applying for asylum," the court said.
"But they remain free to do so on the basis of their national law," it added.
The Orthodox Christian couple and their three young children had challenged the refusal of the Belgian immigration office, citing the EU Charter of Fundamental Rights and the European Convention of Human Rights.
The father claimed to have been abducted by an armed terrorist group, then beaten and tortured, before being release on payment of a ransom.
The family claimed more broadly they risked persecution on account of their religious beliefs.
The EU court ruled that the bloc's visa code was adopted on the basis of a European treaty that allows for intended stays of no more than three months.
"The Syrian family, however, submitted applications for visas on humanitarian grounds with a view to applying for asylum in Belgium and, accordingly, for a residence permit not limited to 90 days," it added.
It warned that allowing third-country nationals to obtain entry visas to obtain international protection in the EU state of their choice "would undermine the general structure" of the bloc's asylum system.
Belgian Prime Minister Charles Michel noted the victory and said "our work goes on".
Francken had warned that the case had risked obliterating European migration policy and hurting Belgium.
An unfavorable court decision would create "a dangerous precedent" that would deny Belgium control of its borders, Francken told Belgian television on Saturday.
"It could trigger a flow of tens of thousands of people toward our consulates in Beirut and Ankara," he added.
A relieved Francken tweeted Tuesday: "European Court of Justice is very clear: EU countries are not obliged to issue humanitarian visa under EU law."