A migrant sits surrounded by Hungarian police officers and soldiers after he tried to cross the border in Roszke between Serbia and Hungary in 2015. Under the deal - agreed at the height of Europe's migrant crisis - Hungary would have to temporarily take in 1,294 asylum-seekers and Slovakia 902.
But the Court's Advocate General Yves Bot, said it was a proportionate response to the crisis and would help Italy and Greece, the two countries at the forefront of the crisis. The court often but not always follows them.
The case has highlighted the deep divide in the European Union over the question of migration.
Twitter reports 2Q loss, user base unchanged from 1Q
Revenue was $573.9 million, down from $602 million in the year-earlier period and above the FactSet consensus of $537.5 million. Following the release of the earnings report, the stock was down almost 10% at $17.73 in early trading indications Thursday.
As of July 24, the total number of relocations stands at 24,676, of which 16,803 from Greece, 7,873 from Italy, according to the latest Commission report on the relocation of refugees released Wednesday. He is calling on European Union member states to step up efforts to re-house migrants in Italy, which is now the main point of arrival for migrants making the risky boat crossing to Europe from north Africa, mostly Libya.
The European Union was correct "to adopt a provisional measure for the mandatory distribution between member states of persons in need of worldwide protection" because it was "necessary to provide an effective response to the migration crisis", Bot wrote, according to the summary.
The European Commission has launched legal proceedings against Hungary, Poland and the Czech Republic for refusing to accept any asylum-seekers under the quota plan.
'Atomic Blonde' Review: It's Got Attitude and Action to Spare, But…
The Berlin of " Atomic Blonde " is bubbling over with spies and hired assassins and double agents and mysterious operatives. The editing works hand-in-hand with this, making for really spectacular transitions that only enhance the overall film.
Poland, which the decision said should take in 6,182 asylum-seekers, supported the positions of Hungary and Slovakia. "We don't want to go on like this", he added.
The two countries filed lawsuits with the European Court of Justice in 2015 shortly after the bloc's leaders pushed through the mandatory quotas to ease the migrant crisis, over the objections of Budapest and Bratislava.
The relocation plan has had limited success so far, though the European Commission said Wednesday that migrant relocation from Greece and Italy to other EU nations reached a record level in June - over 2,000 migrants were relocated from Greece, and almost 1,000 from Italy in June to other EU nations. The program formally ends on September 26, but migrants arriving in the European Union until that date can qualify.
Read the heartbreaking letter Jorah wrote to Daenerys in Stormborn
WATCH: "Game of Thrones" Star Emilia Clarke Spills on the End of the Series: 'I Hope Dany Wins the Whole Damn Thing!' . Did you see any of these coming? Sam cheekily points out that perhaps he should opt for a catchier title.