The European Court of Justice overruled Hungary and Slovakia's objections to the compulsory fixed-quota scheme.
Hungary has not accepted a single asylum seeker since the measures were introduced two years ago.
They were an attempt to ease the pressure on frontline countries such as Greece and Italy.
Just under 28,000 people have been relocated under the scheme, rather than the 160,000 asylum seekers envisaged when it was agreed in September 2015.
EU officials insisted from the start that the scheme was binding on all member states regardless of whether they had voted for it or not. Hungary, Slovakia, the Czech Republic and Romania had objected to the quotas.
'Proportionate'
They argued the problem was not of their making, that the policy exposed them to a risk of Islamist terrorism and that it represented a threat to their homogenous societies.
Hungary and Slovakia argued at the Court of Justice that there were procedural mistakes, and that quotas were not a suitable response to the migrant crisis.
But their case was rejected by the ECJ ruling, which stated: "The Court dismisses the actions brought by Slovakia and Hungary against the provisional mechanism for the mandatory relocation of asylum seekers," it said.
"That mechanism actually contributes to enabling Greece and Italy to deal with the impact of the 2015 migration crisis and is proportionate."
No quick-fix - Kevin Connolly, Europe correspondent
The European Union regards the policy of relocating migrants who've crossed the Mediterranean as an important expression of political solidarity between member states.
Under the policy it set quotas for each country to accept fixed numbers of migrants to ease the direct burden on Italy and Greece - the usual points of arrival.
While Hungary and Slovakia have now failed in their legal challenge to the policy, that doesn't fix the political problem. The European Commission may still have to threaten financial penalties against countries that don't co-operate if the ruling from Strasbourg doesn't change their minds.
No comments: