The approval by politicians from Prime Minister Viktor Orban's Fidesz party, its Christian Democrat coalition partners and the far-right Jobbik party paves the way for the government to launch legal action against the EU to avoid having to take part in the scheme.

The government said earlier it would wait for parliament to weigh in on the issue before deciding on a possible lawsuit.

Neighbouring Slovakia is considering similar steps.

Hungary grants asylum to a few hundred refugees a year and rejects economic migrants.

It has built fences on its borders with Serbia and Croatia which has diverted migrants towards Slovenia in their efforts to reach Germany and other, richer EU countries.

Also on Tuesday, the secretary general of the International Federation of Red Cross and Red Crescent Societies (IFRC) said the sheer scale of the refugee influx to Europe has overwhelmed authorities, and acknowledged more must be done.

During a visit to Greece, the country that has borne the brunt of new arrivals, Elhadj As Sy said the refugee numbers had not been predicted. IFRC figures show 600,000 people have reached Greece so far this year.

"What we are facing is much more than what was expected," Mr As Sy said after meeting Greek migration minister Yiannis Mouzalas. "And that's why everybody is overwhelmed."

Meanwhile Slovakia is sending a unit of 20 police officers to Slovenia to help the tiny Alpine nation protect the external border of Europe's visa-free Schengen zone amid a migrant influx.

The announcement by Prime Minister Robert Fico comes a day after another EU member, the Czech Republic, made the same decision. Mr Fico said the officers might travel to Slovenia as soon as Friday.

Slovakian interior minister Robert Kalinak also said his country is forming a new unit of 300 police officers who will be ready to be deployed to other EU nations to help protect the EU's outer borders. Slovakia has already sent 50 police officers to help Hungary.

Slovenia has said its ability to deal with the influx has been stretched to the limit with thousands of migrants crossing its territory in hopes of reaching Western Europe.