MORAHALOM, Hungary -- Using materials prepared by inmates in Hungarian prisons, 900 soldiers will build a fence along Hungary's border with Serbia by December to stem the flow of migrants, officials said Thursday.

Critics have compared the fence to the Communist-era Berlin Wall and Iron Curtain but Hungary says it has a duty to protect itself and the European Union from the unprecedented number of people -- now often more than 1,000 a day -- arriving on foot through routes across the Balkans.

Defence Minister Csaba Hende said work on the 4-meter (13-foot) -high fence along the 175-kilometre (109-mile) border will take place at 10-12 locations simultaneously.

"The Hungarian defence force is ready to complete this task," Hende said, speaking near the southern town of Morahalom, where a sample section is being built to experiment with different building materials and techniques.

Interior Minister Sandor Pinter said inmates in Hungarian prisons were already assembling the basic elements of the fence, and workers in a government job scheme could also help if needed. He said the fence is the only immediate solution Hungary could find to stop the flow of migrants -- which stands at 81,300 already this year.

After talks Thursday with Romania's president, Serbian President Tomislav Nikolic described Hungary's move to build the fence as an "unfortunate decision."

Janos Lazar, head of Hungary's prime minister's office, said the country would set up temporary tent camps in rural areas to accommodate the large number of asylum-seekers and seek to close its regular migrant housing.

He also said the government would seek to make an illegal border crossing a crime. It is now a minor offence.

"This is a clear message to human-traffickers," Lazar said. "It will be much more difficult, expensive and risky to head toward Hungary."

Prime Minister Viktor Orban says Hungary does not want any migrants from outside Europe. But over the past months, 80 per cent of the refugees requesting asylum in Hungary have come from war-torn countries like Syria, Iraq and Afghanistan. Most leave within days to richer European Union countries like Germany before their asylum claims are settled.

The government's anti-immigrant billboard campaign and a questionnaire sent to voters linking migration with terrorism have been criticized by the U.N.'s refugee agency and others.

Gorondi reported from Budapest. Jovana Gec in Belgrade, Serbia, also contributed to this report.