BUDAPEST (Reuters) - Hungary will not change its anti-immigration stance after the European Union’s top court dismissed a challenge against migrant quotas, Prime Minister Viktor Orban said on Friday.

FILE PHOTO: Hungary’s Prime Minister Viktor Orban listens during a news conference in Budapest, Hungary, July 19, 2017. REUTERS/Bernadett Szabo

The EU’s highest court ruled on Wednesday that member states must take in a share of refugees who reach Europe, dismissing the challenge by Slovakia and Hungary and re-igniting an east-west row that has shaken EU cohesion.

“We must take note of the ruling as we cannot erode the foundation of the EU - and respect of law is the foundation of the EU - but at the same time this court ruling is no reason for us to change our policy, which rejects migrants,” Orban told state radio.

The Mediterranean migrant crisis of 2015 flooded the Balkans, Italy and Greece with migrants, which prompted the EU to impose mandatory quotas on its member countries for relocating asylum seekers.

The flow of migrants has receded, easing pressure to force compliance on nationalist leaders like Orban, who is benefiting from his tough anti-immigrant policies as elections approach in 2018.

Now that the legal challenge has failed, Orban said he would pursue a political fight to force the EU to change its mandatory migrant quotas.

“The whole issue raises a very serious question of principles: whether we are an alliance of European free nations with the Commission representing our joint interests, or a European empire which has its center in Brussels and which can issue orders,” Orban said.

He said EU countries which let in migrants, unlike Hungary, decided to do so of their own will and now they cannot ask Hungary to take a part in correcting their mistake.

“It is not us Hungarians who question the rules of the club, but the Commission had changed the rules and this is unacceptable,” Orban added.

He said that unlike some of the major member states of the EU, whose colonial legacy has made them “immigrant countries”, Hungary did not have a colonial past.

“These countries with colonial legacy, which have become immigrant countries by now, want to impose on us Central Europeans their own logic ... but Hungary does not want to become an immigrant country,” Orban said.

At the same time, he said Hungary was committed to EU membership, because Hungarians had decided in a referendum to join the bloc in 2004.

“No government can lead Hungary out of the EU as it was the Hungarian people which decided to be inside and this is right.”