The European Court of Justice has ruled that Hungary and Slovakia must take in redistributed migrants from other European Union (EU) member states rejecting the legal challenges by the two countries.

The court made its ruling Wednesday afternoon saying that both Hungary and Slovakia must accept redistributed migrants who arrived in Greece and Italy, both Meditteranean nations having seen numbers arrive beyond their capacity to house, L’Express reports.

The two Central European countries claimed that the move to make them accept migrants without the full consent of all member states within the EU, consultation of national parliaments, or the European Parliament was not legally binding. The issue was initially put to the vote with Hungary, Slovakia, Romania, and the Czech Republic all voting against the measure.

Hungary went a step further last October holding a national referendum on the issue in which the public overwhelmingly voted against migrant redistribution.

Hungary’s Orbán Says EU ‘Destroying’ Europe Days Before Migrant Quota Referendum https://t.co/z918cTLkyv pic.twitter.com/VOQL46wv95 — Breitbart London (@BreitbartLondon) September 29, 2016

The court decided that the measure, which they said is a non-legislative procedure, is fully within the guidelines of the EU’s community standards and therefore legal.

The redistribution policy has so far largely been a failure having only redistributed 28,000 migrants since 2015, far short of its initial goal of 120,000.

Over the weekend, Hungarian Prime Minister Viktor Orbán addressed the issue ahead of the ruling: “Hungarian voters have made it clear that they don’t wish to delegate this power to Brussels, and we wish to decide on who we should live alongside.”

The Hungarian leader also cited studies showing the predicted drastic increase of Islamic migrants from Africa in the coming decades saying: “The Islamization of Europe is real.”

Hungary, along with Poland, has not taken in any redistributed migrants so far but the EU is not considering court action if they continue to refuse.

Dimitris Avramopoulos, the European commissioner for migration, said: “The door is still open, and we should convince all member states to fulfil their commitments, but we should be clear that member states have to show solidarity now.”

Former UKIP leader Nigel Farage also commented on the ruling defending the Hungarian and Slovakian position saying, “What a surprise – EU court undermines national sovereignty once again. It should be a decision of nation states who it allows inside its borders.”