A migrant sits on the ground arrested by Hungarian police officers and soldiers after he tried to cross the border line between Serbia and Hungary in Roszke, southern Hungary, Tuesday, Sept. 15, 2015. Hungary deployed a boxcar bristling with razor wire to close a key border crossing and warned of a new era of swift deportations Monday as governments across Europe debated how to share the burden of housing hundreds of thousands seeking refuge — and whether the continent's hard-won policy of passport-free travel could survive the unrelenting flow of humanity. AP Photo/Matthias Schrade Hungary sealed off its border with Serbia with massive coils of barbed wire Tuesday and began detaining migrants trying to use the country as a gateway to Western Europe, harsh new measures that left thousands of frustrated asylum-seekers piled up on the Serbian side of the border.

Human rights activists condemned the move, with Amnesty International saying Hungary's "intimidating show of militarized force is shocking."

But Prime Minister Viktor Orban defended the measures, saying he was acting to preserve Christian Europe, which he said had become threatened by the large numbers of Muslims streaming into the continent.

"The supply is nearly endless — we can see how many of them are coming," Orban said in a televised address just before the new laws took effect at midnight. "And if we look at the demographics, we can see that these people have more children than our communities who lead a traditional, Christian way of life."

"Mathematics tells you that this will lead to a Europe where our way of life will end up in a minority, or at least face a very serious challenge."

By nightfall Tuesday, thousands of migrants, including many babies and children, prepared to spend a night in the open or in flimsy tents erected in the bushes or on the main highway near the Serbian border with Hungary.

Men collected wood in a nearby forest for fires in preparation for a chilly night.

"I had hope until now, but it's all gone," lamented Mohammad Mahayni, a 32-year-old Syrian from Damascus, who became separated from his wife as they tried to enter Hungary a day earlier.

"I lifted the razor wire for her, she got in before a Hungarian border patrol came by," he said. "Now I don't know where she is."

A migrant looks and reacts at the closed railway border crossing between Serbia and Hungary, near Horgos, Serbia, Tuesday, Sept. 15, 2015. Hungary has declared a state of emergency in two of its southern counties bordering Serbia because of the migration crisis, giving special powers to police and other authorities. AP Photo/Darko Vojinovic

The new laws make it a crime to breach or damage the 13-foot (4-meter) high razor-wire fence erected along 110 miles of Hungary's border with Serbia and include longer prison terms for convicted human traffickers. Authorities said they detained 174 people who tried to cross the border Tuesday. Hungary has said it will turn most of the migrants back to Serbia, which it considers a safe country where they could also request asylum.

The developments mark a dramatic reversal for Hungary, an East European nation that played a key role in cracking open the Iron Curtain in 1989 when it removed a border fence to Austria, prompting large numbers of East Germans to flee to the West.

At the European Parliament in Brussels, European Commission President Jean-Claude Juncker paid an unexpected tribute Tuesday to Gyula Horn, the late Hungarian prime minister who dismantled that fence. He appeared at the unveiling of a bust of Horn, praising him as "a great Hungarian, a great person, a great European" — a clear gesture of reproach of Orban.

Hungary also declared a state of emergency in two southern regions Tuesday, giving authorities greater powers to deal with the crisis and allowing them to shut down roads and speed up asylum court cases.

That also allows the military to be deployed to defend the border, pending approval by parliament next week, though heavily armed military personnel with vehicles and dogs have been seen patroling the border for days.

A migrant boy pulls tents on the road near the "Horgos 2" border crossing into the Hungary, near the Horgos, Serbia, Tuesday, Sept. 15, 2015. Hungary has declared a state of emergency in two of its southern counties bordering Serbia because of the migration crisis, giving special powers to police and other authorities. AP Photo/Darko Vojinovic

"For refugees fleeing from terrifying conflict zones to be met by such an intimidating show of militarized force is shocking, and a woefully irresponsible response to people already traumatized by war and brutality," said Gauri van Gulik, Amnesty International's deputy director for Europe.

The Hungarian government said it plans to extend the steel razor-wire fence — which it calls a "temporary border closure" — several miles (kilometers) along the border with Romania as well, something the Bucharest government said violated the "European spirit" of cooperation.

"I am horrified to think of one thing that is possible: What do we do if Hungarian troops begin to shoot or kill children and women?" Romanian Prime Minister Victor Ponta said late Tuesday on Antena 3 television.

Though Orban's steps are extreme, the migrant crisis has forced other European governments to reinstate border checks, possibly heralding a threat to the free movement across EU frontiers — one of the most cherished benefits brought by their union.

This week, Germany and the Netherlands were among countries that reintroduced border checks to manage the huge flow of people, while the Czech Republic said Tuesday it is prepared to deploy its armed forces to protect its borders if police alone cannot manage the crisis.

Migrants walk by a wire fence near the closed railway border crossing between Serbia and Hungary, near Horgos, Serbia, Tuesday, Sept. 15, 2015. Hungary has declared a state of emergency in two of its southern counties bordering Serbia because of the migration crisis, giving special powers to police and other authorities. AP Photo/Darko Vojinovic

Meanwhile, Austria's Interior Ministry announced it would impose border controls with Hungary starting at midnight Tuesday and said the measures could be extended to the country's borders with Slovenia, Italy and Slovakia if necessary. The move was in response to fears that migrants now streaming into Austria from Hungarycould try to cross into the country over those borders in large numbers.

Abolfazl Ebrahimi, a 17-year-old Afghan who was in Athens on Tuesday, said his group now plans to get to Western Europe through Croatia.

"I thought that European people are kind and they will give us rights. But I don't think so (anymore) because the borders between Germany and Austria are closed, and Serbia and Hungary are closed too," he said.

In the last few months, Hungary has become a main entry point and bottleneck into the European Union for migrants, many of them war refugees from Syria, Iraq and elsewhere in the Middle East. More than 200,000 migrants have entered Hungary so far in 2015, nearly all by walking across the southern border with Serbia, as they make their way to Germany or other wealthy Western European nations.

Serbia's foreign minister declared it was unacceptable that migrants were being sent back from Hungary while more and more were arriving from Macedonia and Greece.

Migrants play soccer at the closed railway border crossing between Serbia and Hungary, near Horgos, Serbia, Tuesday, Sept. 15, 2015. Hungary has declared a state of emergency in two of its southern counties bordering Serbia because of the migration crisis, giving special powers to police and other authorities. AP Photo/Darko Vojinovic

Serbia "wants to be part of the solution, not collateral damage. There will have to be talks in the coming days with Brussels and other countries," Serbian Foreign Minister Ivica Dacic said in Prague.

The turmoil at the Hungarian-Serbian border came a day after the 28-nation EU failed to come up with a united immigration policy at a contentious meeting in Brussels. The ministers did agree to share responsibility for 40,000 people seeking refuge in overwhelmed Italy and Greece and spoke hopefully of reaching an eventual deal on which EU nations would take 120,000 more refugees, including some from Hungary.

The effectiveness of Hungary's moves was underlined dramatically by statistics: On Monday, with some gaps still open in the boder, 9,380 migrants managed to pass into Hungary, a record high as people rushed to get into the European Union before the gates shut behind them.

When the measures took effect at midnight, almost nobody got in. Hungary said it received 72 requests for asylum by evening Tuesday but had not approved any.

(Gera reported from Budapest, Hungary; Pablo Gorondi and Alex Kuli in Budapest, Mike Corder in Roszke,Hungary, Geir Moulson in Berlin, Alison Mutler in Bucharest, Romania, and George Jahn in Vienna contributed to this report.)