A ruling by the European Union's top court upholding the relocation of asylum-seekers opens the way to a "mixed culture and population" on the continent, Hungary's prime minister has warned.

Viktor Orban said he "took note" of Wednesday's ruling by the European Court of Justice rejecting legal arguments by Hungary and Slovakia against the EU decision to relocate 160,000 asylum-seekers from Greece and Italy within the bloc, but he would continue to oppose the plan.

"Now, instead of a legal fight, we have to fight a political fight," Mr Orban said during an interview on state radio.

"We have to get the different EU organisations to say that the decision they made, even if it was legal, was a bad decision ... which the member states can't and won't carry out."

Despite frequent urging by EU officials, only around 27,700 people have been relocated since September 2015.

"We are not an immigrant country and Hungary does not want to be an immigrant country," said Mr Orban.

The EU "is trying to transform Europe's traditional population and culture into a continent with a mixed population and a mixed culture".

Hungary built razor-wire fences on its southern borders in late 2015, when 400,000 migrants from the Middle East and Asia passed through the country on their way to western Europe.

Mr Orban says the fences, which have practically stopped the migrant flow, also protect Austria, Germany and the rest of Europe and has asked the EU to contribute about 440 million euros (£400 millon) to cost and maintenance.

The EU said it would not fund the fences but urged Hungary to apply for money available for "border management".

In a written response, European Commission President Jean-Claude Juncker reminded the Hungarian leader his country was the largest recipient of EU developments funds in terms of gross domestic product, with the 25 billion euros (£23 billion) allocated in 2014-20 totalling over 3% of Hungary's GDP.

EU mentions of the development funds have drawn strong responses from the Hungarian government, and Mr Orban on Friday again made his position clear.

"There is no possibility to set the question of immigration as a precondition for the allocation or distribution of EU funds. Such a correlation is illegal."

Hungary has benefited greatly from EU membership, supported by a large majority of Hungarians, but Mr Orban has compared EU bureaucrats in Brussels to Soviet-era apparatchiks and sees "unelected EU officials" as trying to stealthily increase their power over member states.

The Hungarian government has also conducted several anti-EU campaigns, charging Brussels with trying to "colonise" Hungary and of disregarding Hungarian support for Mr Orban, who returned to power in 2010.

In parliamentary elections expected in April next year, he hopes to regain the two-thirds majority that allowed him in 2012 to introduce a new constitution.

He has set countries like Russia and Turkey as models for his efforts to turn Hungary into an "illiberal state", a concept that includes an increasingly dominant role for the state and little regard for the democratic system of checks and balances.