In the latest twist to a divisive dispute that broke out two years ago when over a million migrants poured across the Mediterranean, the European Court of Justice found that the EU was entitled to order national governments to take in quotas of mainly Syrian refugees relocated from Italy and Greece.
"The court dismisses the actions brought by Slovakia and Hungary against the provisional mechanism for the mandatory relocation of asylum seekers," the Luxembourg-based court said, adding it rejected the complaints "in their entirety".
"The mechanism actually contributes to enabling Greece and Italy to deal with the impact of the 2015 migration crisis and is proportionate."
The programme set up by the executive European Commission was approved by majority vote of member states in the face of opposition from formerly communist countries in the east who said their societies could not absorb mainly Muslim immigrants.
It provided for the relocation of up to 120,000 people, but only some 25,000 have so far been moved. A further programme for resettling people directly from outside the EU has also struggled to hit targets for taking in asylum-seekers.
Diplomats had expected the ruling and believe it may lead to resuming EU talks over an emergency mechanism for exceptionally high arrivals of refugees and migrants. The issue has been stalled for more than two years and divided the bloc at a time it faces Brexit, security threats and international challenges.
"We've been waiting for this to revive talks about the EU asylum system reform," an EU diplomat said before the ruling.
The challengers from the EU's east say the obligatory relocation of asylum-seekers arriving in frontline countries like Greece and Italy via the Mediterranean undermines their sovereignty and endangers their homogenous societies.
They have said the bloc should instead control its external borders better to crack down on illegal immigration -- something Brussels says it has succeeded in doing in the past two years.
MIGRATION HEADACHE
The EU has taken in more than 1.7 million people from the Middle East and Africa since 2014. But, after a mass influx in 2015, numbers have gone down steadily following actions last year that all but closed the route from Turkey to Greece and from Greece to the Balkans and northern Europe. The EU has also increased support for Libya to curb arrivals in Italy.
The eastern EU states say they can send equipment and border guards to the bloc's external frontiers but do not want to accept refugees because of security risks after a raft of Islamist attacks in Western Europe.
Hungary and Poland have refused to host a single person under the 2015 sharing scheme, while Slovakia and the Czech Republic have each taken in only a dozen or so. The countries concerned -- Poland backed the complaint but did not formally join it -- had been prepared to lose in court following an early recommendation to the justices in July.
"We will react by making clear we respect the court ruling," a senior Slovak diplomat said on Tuesday.
"We will also say we still think that's not the way to solve the problem but we'll say we'll go on with relocation."
Western EU states, including Germany which took in the vast majority of the people who made it into the bloc and which will holds a parliamentary election on September 24, say the easterners cannot be exempted from showing solidarity.
Italy has been calling for taking away from the reluctant easterners some of the substantial EU funding they use to catch up with the wealthier West as punishment for their stance on migration.
While the EU has sought in vain to come up with a compromise, the court ruling may just force Brussels' hand.
It is a delicate balancing act as putting such a thorny issue to a vote, and possibly passing a migration reform despite opposition from several states, would cause even more bad blood.
"If we push it through above their heads, they will use it in their anti-EU propaganda at home," another EU diplomat said of Poland and Hungary, where the nationalist-minded governments are embroiled in disputes with Brussels over democratic rules.
"But the arrivals are low, we have it more or less under control, so we have to get back to the solidarity mechanism."