Hungary's right-wing government shut the main land route for migrants into the European Union on Tuesday, taking matters into its own hands to halt Europe's influx of refugees.
An emergency effort led by Germany to force EU member states to accept mandatory quotas of refugees collapsed in discord.
Chancellor Angela Merkel appealed for European unity after one of her ministers called for financial penalties against countries that refused to accommodate their share of the migrants, provoking anger in central Europe.
A Czech official described such threats as empty but nonetheless "damaging" while Slovakia said they would bring the "end of the EU".
Under new rules that took effect from midnight, Hungary said anyone seeking asylum on its southern border with Serbia, the EU's external frontier, would automatically be turned back, and anyone trying to sneak through would face jail.
At the border, migrants barred from continuing their long journey north towards a new life in Germany chanted as the sun went down, and one held up a banner saying: "Mama Merkel, please help us!"
Families with small children sat in fields beneath the new 3.5-metre- (10-foot-) high fence, topped with razor wire, which blocks entry for migrants to the former communist country.
"Strike. No food. No water. Open this border," a woman had written on a child's dress that she held above her head.
Migrants who tried to apply for asylum in a transit zone of metal containers were swiftly turned away. Macruf Suhufi Abdi Omar, a Somali, told Reuters he had been refused asylum barely an hour after he gave his fingerprints.
Hungarian officials said they had denied 16 asylum claims at the frontier within hours and were processing 32 more. Police had arrested 174 people for trying to sneak across the border.
Prime Minister Viktor Orban, one of the continent's loudest opponents of mass immigration, says he is acting to save Europe's "Christian values" by blocking the main overland route used by mainly Muslim refugees, who travel through the Balkans and cross his country mainly to reach Germany or Sweden.
Amnesty International accused Hungary of "showing the ugly face of Europe's shambolic response" to the crisis.
The great migration has led to the unraveling of one of the 28-member EU's signature achievements, its Schengen system of border-free travel across much of the continent.
Record arrivals forced Berlin to reimpose emergency frontier controls this week, with several neighbors swiftly following suit. Austria, next on the road from Hungary to Germany, said tougher border measures would take effect at midnight.
Germany stepped up the pressure on EU states resisting the plan to spread refugees around the bloc under a mandatory quota system. Interior Minister Thomas de Maiziere said the EU should penalise countries that reject quotas.
"I think we must talk about ways of exerting pressure," he told ZDF television, adding that some of the countries that opposed quotas were beneficiaries of EU funds.
Tomas Prouza, the Czech State Secretary for the EU, said the apparent German threat to cut off EU funds was "empty but very damaging to all". Slovak Prime Minister Robert Fico declared his country would never agree to quotas, and threats of financial retaliation would lead to "the end of the EU".
Merkel later called for a special EU refugee summit, and distanced herself from her minister's comments. "We need to establish a European spirit again," she told a news conference. "I don't think threats are the right way to achieve agreement."
US President Barack Obama said the crisis had worsened and required cooperation from Europe and the United States.
"The United States feels it is important ... to also take our share of Syrian refugees as part of this overall humanitarian effort," he added during a meeting with Spain's King Felipe VI.
After later meeting German state leaders, Merkel added: "There was great agreement that we want to give shelter to those people who need shelter, and will do everything humanly possible to do so. On the other hand, we were also clear that those who have no prospect of staying, cannot stay in our country."
EU interior ministers, who failed to agree on Monday on the quota system championed by Germany, will meet again on September 22.
Eastern European countries argue that a welcoming stance encourages more people to come, overwhelming welfare systems and risking the dilution of national cultures.
Under its new rules, Hungary said it had determined Serbia was "safe", and therefore it could automatically deny asylum claims at the border.
"If someone is a refugee, we will ask them whether they have submitted an asylum request in Serbia. If they had not done so, given that Serbia is a safe country, they will be rejected," Orban was quoted as telling private broadcaster TV2 on Monday.
Serbia called the new Hungarian rules "unacceptable". The United Nations disputed the definition of Serbia as safe, saying the poor ex-Yugoslav state lacked capacity to house thousands of refugees turned back at Europe's gates.
Orban says that by reinforcing the EU's external border his government is merely enforcing EU rules, and that no countries are duty-bound to take in refugees that pass through safe states. Critics at home and in European neighbors say some of his rhetoric has crossed a line into alarmism and xenophobia.
WE HAVE LOST EVERYTHING
At the border, migrants were close to despair. "I don't know what I will do," said 40-year-old Riad from Aleppo in Syria. "I will wait to see. We have lost everything to reach this point."
A record 156,000 migrants entered the EU in August, the bloc's border agency Frontex reported, taking the total for the year to more than 500,000. Frontex chief Fabrice Leggeri told Reuters his agency was preparing to speed up identification of illegal migrants and would help to deport them in large numbers.
EU data show just under half of asylum claims were granted last year but less than half of those rejected were deported.
Germany has prepared for as many as 800,000 asylum seekers this year, and some officials say that may be an underestimate.
"We're on the street now," said Mouz, a 22-year-old Syrian, who slept on the Hungarian border. Asked if he might consider another route, he replied: "I don't know. I'm from Syria. I cannot go back."
Serbia says it is readying more temporary accommodation but will not accept anyone turned back from Hungary.
"That's no longer our responsibility," Aleksandar Vulin, the minister in charge of policy on migrants, told the Tanjug state news agency. "They are on Hungarian territory and I expect the Hungarian state to behave accordingly towards them."