Chaos ensued at the border, as hundreds of migrants piled up in a no man's land, and Serbian officials reacted with outrage.
Stuck for an unknown amount of time on a strip of road between the two countries' checkpoints, those fleeing violence in their homelands pitched tents and settled in. But frustrations were on the rise. As a police helicopter hovered above, migrants chanted "Open the border!" and shouted insults at Hungarian riot police. Some refused food and water in protest.
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.
"(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," Ivica Dacic said in Prague.
The turmoil at the Hungarian-Serbian border came a day after the 28-nation bloc 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 — next month or by the end of the year — on which EU nations would take 120,000 more refugees, including some from Hungary.
German Chancellor Angela Merkel and Austria called Tuesday for a special European Union summit next week to discuss the continent's immigration crisis.
Hungary, however, was not pinning its hopes on any action soon from Brussels or its neighbors. Tuesday's state of emergency in two southern regions gave authorities greater powers to deal with the crisis, allowing them to shut down roads and speed up asylum court cases.
In the last few months, Hungary has become a major bottleneck and entry point into the European Union for migrants, many of them war refugees from Syria and elsewhere in the Middle East. Prime Minister Viktor Orban, however, has insisted that most arriving are economic migrants seeking a better life, not war refugees entitled to protection — a view sharply at odds with other EU nations, including Germany.
The new laws that took effect at midnight in Hungary now make it a crime to cross or damage a 4-meter (13-foot) razor-wire fence the government has built along the southern border with Serbia and also includes longer prison terms for convicted human traffickers.
"Due to the situation caused by mass migration, the Hungarian government declares a state of crisis," government spokesman Zoltan Kovacs told reporters in the southern city of Szeged. "We are very clear on this: Illegal border crossing is a crime."
Technically, parliament must still approve the deployment of the military, expected next week, but Associated Press reporters at the border have seen heavily armed military personnel with vehicles and dogs for days.
Gyorgy Bakondi, homeland security adviser to Orban, said authorities caught 45 people trying to cross at the border and 15 deeper in the country. They got across by damaging the fence, are now in police custody and are being charged with committing offenses under the new laws. Authorities are quickly repairing the fence.
Hungarian officials also closed two of seven border crossings with Serbia on Tuesday morning after deploying a train car covered with razor wire to close one of them.
Chaos enveloped the main border crossing near Roszke, Hungary, as the Hungarians opened a tiny office in a metal container to process people and crowds pressed to squeeze inside. About 20 managed to get in, but thousands remained outside.
Another group of migrants blocked the main highway connecting Serbia and Hungary, saying they were refusing food and water until they are allowed to cross into Hungary. "No food, no water until open border," read one sign in English held up by a migrant.
Aleksandar Vulin, the Serbian social affairs minister in charge of migrants, urged the European Union to take charge of the escalating crisis at the Hungarian border, which he insisted had to remain open.
"The Hungarians never told us that they will close the border," he told The AP as he toured the border. "This is not only a Hungarian and Serbian problem. This is a problem for the whole of Europe. Europe has to find a solution fast before the situation escalates even further.
Those who managed to make it into Hungary on Monday were grateful to be boarding buses for Austria.
Zakariah Sharfo Surian, a mechanic from the Syrian city of Aleppo, said he couldn't understand the new hard-line Hungarian laws.
"Those who leave their country are fleeing because of the pressures of war," he said. "To escape death for a better life and to escape the pressures in our country. No one would leave their country without a good reason."
Migrants had rushed to beat the Hungarian deadline. A record 9,380 migrants entered Hungary on Monday, beating the previous record of 5,809 set just a day earlier.
Some 200,000 migrants have entered Hungary so far in 2015, nearly all by walking across the southern border with Serbia. Almost all, however, are on their way to Germany or other wealthy Western European nations.
In other news about the Europe's immigration crisis:
— Turkish media reported that 22 people, including four children, drowned after a 20-meter (66-foot) wooden boat sank off Turkey's coast. The private Dogan agency said 211 people were rescued from Tuesday's sinking between Datca in Turkey and the Greek island of Kos.
—Germany Interior Minister Thomas de Maiziere said he supports the idea of cutting EU funding to countries that refuse to share the burden of hosting refugees. Several EU countries, particularly in east, have rejected calls for mandatory quotas to spread refugees out. De Maiziere told ZDF television there needs to be discussion of how to exert pressure and that the countries rejecting quotas often receive significant amounts of EU funding.
— Austria, which borders Hungary, warned Tuesday it might soon be short of emergency shelters.