The European Court of Justice (ECJ) said on Wednesday (6 September) that an EU Council decision in September 2015 that imposed the quota system was valid.
EU interior ministers at the time voted to share 120,000 asylum seekers from frontline states Greece and Italy.
They were to be distributed according to calculations based on member states’ size and wealth, with Hungary obliged to take 1,294 people and Slovakia to take 902.
The Czech Republic, Hungary, Romania, and Slovakia voted against the scheme. Poland later joined the rebels after a change of government in Warsaw.
Hungary and Slovakia also launched legal action at the ECJ in December 2015.
They said the interior ministers’ vote was contrary to an earlier EU summit commitment.
They also said that the Council should have tabled a new proposal after Hungary had boycotted an initial one and that the European Parliament should have been consulted.
Some diplomats from the rebel EU countries still refer to the quota vote as an “original sin” that broke trust between the Commission and eastern and central European governments.
The Slovak prime minister, Robert Fico, called the migrant quota system “politically dead” last year.
Wednesday’s court decision is likely to aggravate an already difficult debate.
Leading EU countries, including France and Germany, have accused the quota rebels of showing lack of EU solidarity.
But right-wing governments in Hungary and Poland have accused the EU of violating their sovereignty and of creating a terrorist risk by trying to force them to take in Muslims.
The Commission launched legal action against Hungary, Poland, and Slovakia in June for their boycott of the quota scheme.
Those cases could also end up in the ECJ, leading to potential fines, with Wednesday’s court verdict strengthening the Commission’s hand.
Hungary and Poland had not taken any migrants from Italy or Greece as of 1 September.
The Czech Republic and Slovakia had taken in just 28 people in total over the past two years.
The legal disputes come as member states continue debating the reform of the EU’s asylum system, including the relocation of asylum seekers, in case there is another mass-scale influx of people as in 2015, when more than 1 million came to Europe seeking help.