European Union divisions over migration were brutally laid bare today after the EU’s top court ruled that member states would be forced to accept thousands of asylum seekers under a compulsory quota system.

“Politics has raped European law and values,” Peter Szijjarto, Hungary’s foreign minister, told a news conference. “The Hungarian government considers today’s decision by the European court to be appalling and irresponsible.”

The European Court of Justice dismissed Hungary and Slovakia’s legal challenge to the quota system, which was devised at the height of the migration crisis two years ago to relocate thousands of refugees in under-pressure Greece and Italy across the EU. Thanks to its opt-out on EU asylum policy, Britain is exempt from the scheme.

Hungary and Slovakia, with the support of other eastern member states, went to the court to block the EU decision to relocate 120,000 Syrian and other asylum seekers. Hungary, which faced international criticism after erecting controversial fences on its border with Serbia and Croatia, has refused to take in a single asylum seeker under the scheme.

Beata Szydlo, the Polish prime minister, who, like Hungary’s Viktor Orban, is a steadfast opponent of the quota plan said: “We expected this decision. However, this does not change the position of the Polish government on migration policy.”