Hungary plans to house all refugees and migrants entering the country, as well as those already in existing facilities, in border camps built of containers, the government announced Thursday.

The tough new measure affecting migrants waiting for asylum claims to be processed, is the latest step by right-wing Prime Minister Viktor Orban's government to deal with the thousands of people trying to get into Europe over the past two years.

"People's freedom of movement will be removed, they will be able to stay only in a place designated for them," Orban's chief of staff, Janos Lazar, said at a weekly press briefing.

"This place will be the state border, where containers suitable for accommodating 200-300 people will be erected. Migrants will have to wait there for a legally binding decision on their claims," Lazar said.

Claimants will be able to take part in court proceedings via telecommunications equipment in the camps, he added.

A total of 586 migrants currently staying in open and closed camps elsewhere in Hungary will also gradually be transferred to the new sites, he said.

Lazar announced the plans as part of a package of legal proposals to go before parliament that would reintroduce automatic detention for asylum seekers arriving in Hungary.

Last month Orban, a fervent supporter of US President Donald Trump, said the systematic detention of migrants was needed in response to recent "terror" attacks in Europe.

"As long as there is a verdict outstanding they cannot move freely in Hungary," said Orban, who has long railed against the "poison" of immigration.

Hungary suspended its detentions of asylum applicants in 2013, under pressure from the EU, the UN refugee agency and the European Court of Human Rights.

"But since then there have been terror acts in western Europe," Orban said in January. "Any legal regulation that facilitates terror acts must be changed in the interests of our own self-defence."

He said he was aware that this "openly goes against the EU", of which Hungary is a member, putting his government in "open conflict" with the 28-nation bloc.

It has also been criticised by refugee rights advocates.

"Automatic detention of all asylum-seekers from the start till the end of the asylum procedure is a flagrant and clear breach of EU law and human rights standards," the Hungarian Helsinki Committee, a Budapest-based refugee rights group, said in an email statement to AFP.

"In addition, the indefinite detention of many vulnerable migrants, including families with small children, is cruel and inhuman," it said.

Orban has regularly crossed swords with the European Union over migrants, including by erecting fences on Hungary's border with Serbia and refusing to take part in a scheme to spread refugees around the bloc.

Orban says that allowing migrants in without proper checks poses a security threat, citing the fact that some of the Islamist extremists responsible for attacks like those in Paris in November 2015 had posed as refugees.

But many others who have carried out attacks or tried to were born in Europe.

Orban has also argued that allowing in so many Muslims risks undermining Europe's democratic values and its Christian traditions.