According to the ECJ, Poland intervened on Hungary's behalf in the court battle.
'That mechanism actually contributes to enabling Greece and Italy to deal with the impact of the 2015 migration crisis and is proportionate'. The court has further defended the policy stating that, "The small number of relocations so far carried out under the contested decision can be explained by a series of factors ... including, in particular, the lack of cooperation on the part of certain member states". However, at the moment were allocated only about 25 thousand people.
The ECJ claims that the European Union is entitled to making such exceptions in the legislative process, saying that the quotas help relieve the considerable pressure on the asylum systems of Italy and Greece. Of those, 19,200 were transferred from Greece and 8,212 from Italy.
"But we should be clear that member states have to show solidarity now because it is now that some member states need help". But he said his government still is not happy with the relocation plan, which he and others from Eastern Europe see as being imposed on their countries by non-elected European Union bureaucrats.
The court statement said Poland intervened in support of Hungary during the proceedings, while the executive European Commission, along with Greece, Italy, Germany, Sweden and several other member states, backed the relocation plan.More news: US Pop Icon Madonna confirms she's relocated to Portugal
More news: This Is President Trump's Official Pick For NASA Administrator
More news: Magnificent Majka climbs to Vuelta stage 14 win as Froome protects lead
The countries claimed the relocation scheme was non-binding as they had voted against the deal, together with the Czech Republic and Romania.
The case has highlighted a deep divide in the European Union as it has fumbled for a joint solution to the mass arrivals that have strained resources, roiled politics, and prompted outcries from human rights defenders who warn that the bloc risks violating global law on the treatment of refugees. Slovakia and the Czech Republic have only taken in a handful.
Mr Szijjarto called the decision "outrageous and irresponsible" and, echoing the view of Hungarian prime minister Viktor Orban, he said it "jeopardises the security and future of all of Europe".
But Slovakian Prime Minister Robert Fico said he accepted the court's decision. "Time to work in unity and implement solidarity in full", said EU Migration Commissioner Dimitris Avramopoulos.
The UN's migration agency reports that 125,860 migrants and refugees entered Europe by sea so far this year.