Following the outbreak of the coronavirus pandemic in 2020, Budapest introduced new rules forcing asylum-seekers to first travel to the Hungarian embassies in Serbia or Ukraine to apply for a travel permit.
Hungarian authorities could then decide whether to allow the migrants to enter Hungary to formally lodge an asylum claim.
The European Commission, the EU's executive branch, took Hungary to court over the measure, arguing the extra step breached the bloc's laws and migrants' rights.
Prime Minister Viktor Orban's government has frequently clashed with EU member states over its treatment of asylum-seekers as well as rule of law violations.
What did the ECJ say?
The EU's top court sided with the European Commission.
It found that by "making an application for international protection subject to the prior submission of a declaration of intent at a Hungarian embassy situated in a third country," the government in Budapest "has failed to fulfill its obligations," a court statement said.
Under EU law, all 27 member states are obliged to have common procedures for granting asylum.
The Luxembourg-based court said Hungary's actions were effectively depriving people seeking protection of their right to "effective, easy and rapid access" to the asylum procedure.
The judges also found that the regulation, introduced during the pandemic, was not an effective measure to prevent the spread of the coronavirus.
nm/ab (AP, dpa)