The main railway station in the Hungarian capital, Budapest, has opened its doors to hundreds of migrants after a two-day stand-off.
But a public announcement said international trains to Western Europe were suspended “indefinitely”.
Hungary’s anti-immigrant Prime Minister Viktor Orban said nobody could leave Hungary without being registered.
EU rules place responsibility for assessing asylum claims on the country where a migrant first arrives.
Many of the migrants currently in Hungary have been refusing to register there, in order to continue their journeys to Germany before seeking asylum.
The migrants stuck at Budapest’s Keleti station were prevented from boarding trains on Tuesday and Wednesday. Some were involved in scuffles with police.
They had bought tickets after Hungary briefly appeared to abandon efforts to register migrants, allowing huge numbers to board trains to Vienna and southern Germany.
It was not immediately clear why authorities decided to let the migrants enter the station on Thursday morning.
Many tried to cram into a train that was listed as destined for Munich, but the BBC’s Nick Thorpe reports from the station that word was spreading that people would not be allowed to travel on to Germany.
A message on an announcement board said international tickets would be accepted on internal trains.
The number of migrants entering Europe has reached record levels, with 107,500 arriving in July alone.
Germany expects to take in 800,000 migrants this year – four times last year’s total.
The surge in numbers has created tension and disagreement over EU migration policy. Germany has been prepared to accept large numbers of asylum seekers, but other countries have not.
Mr Orban, who was in Brussels for talks, said border control was “the number one issue”.
“Hungarians are full of fear,” he said. “People of Europe full of fear because they see that the European leaders, among them the prime ministers, are not able to control the situation.”
During a tense press conference with European Parliament President Martin Schulz, the Hungarian leader said the migrant crisis was “a German problem”.
“Nobody would like to stay in Hungary,” he said. “Our job is only to register them.”
Mr Orban wrote in an opinion piece published in Germany’s Frankfurt Allgemeine Zeitung on Thursday that his country was being “overrun” with refugees who threatened to undermine the continent’s Christian roots.
The foreign minister of Luxembourg, which holds the EU presidency and will chair a meeting on 14 September to address the migrant crisis, called for a creation of a European refugee agency, with European officials deployed on borders in the event of a crisis.
Jean Asselborn also said all EU countries should have the capacity to absorb refugees.
“The EU’s values must be valid through the union. No-one can say we don’t want Muslims or blacks,” he told German daily Sueddeutsche Zeitung.
On Wednesday, Germany, Italy and France called for “fair distribution” of refugees throughout the EU.
The human cost of the crisis was also put into sharp focus on Wednesday when five children were among 12 migrants who drowned in Turkish waters while trying to reach Greece.
Images of the washed-up body of a three-year-old boy, who died alongside his mother and five-year-old brother, circulated widely on social media.