Hungary and Slovakia told the European Union’s top court on Wednesday that sharing out asylum-seekers among member states under a quota system was unlawful, clashing with Germany, France and others in a dispute that threatens to tear the bloc apart.

Some 1.6 million migrants and refugees have crossed the Mediterranean and entered the EU since in 2014, mostly fleeing conflicts or poverty in the Middle East and Africa.

The EU proposed in 2015 redistributing just 120,000 of them to help relieve pressure on frontline states Italy and Greece but ran into fierce resistance from ex-communist countries.

During a hearing at the EU’s Luxembourg-based Court of Justice, Hungary and Slovakia defended their refusal to take in asylum seekers, drawing a clear rebuke from Germany and others who stressed the need for European solidarity.

“One of the main arguments is the incorrect legal basis,” said Krisztian Kecsmar, a Hungarian justice ministry official. “It is a matter of institutional equilibrium, what role the institutions play in decision-making.”

The leaders of Hungary and Slovakia, Viktor Orban and Robert Fico, have sought to cast the quota system – agreed by EU in a majority vote against the will of four eastern states – as an example of heavy-handed rule by remote bureaucrats in Brussels.

Poland’s previous, pro-EU government reluctantly voted in 2015 for the quotas, which are based on a country’s population and wealth, but it has since been replaced by a more eurosceptic administration which has also refused to implement the decision.

On Wednesday, Poland was the only EU state in the courtroom to back Slovakia and Hungary. A Polish envoy said accepting migrants and refugees could pose a threat to national security.

Tags: ; ; ; ;