A sign pasted onto the border fence on the Hungary-Serbia borderline warns refugees that damaging the fence is a criminal offence at Roszke, Hungary, September 2, 2016. Picture taken September 2, 2016. REUTERS/Laszlo Balogh

LUXEMBOURG (Reuters) - The European Union’s top court dismissed complaints on Wednesday by Slovakia and Hungary about EU migration policy, upholding Brussels’ right to force member states to take in asylum seekers.

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 in a statement.

“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 160,000 people, but only some 25,000 have so far been moved.