Hundreds of migrants have been protesting outside a major railway station in the Hungarian capital after police sealed off the terminal to stop them travelling through the EU.
Crowds of people chanted “Germany” and waved train tickets after being forced to leave Keleti station in Budapest.
Officials said Hungary was trying to restore order and enforce EU rules.
Austrian police said 3,650 migrants arrived in Vienna from Hungary on Monday, with most heading for Germany.
Hungarian officials had earlier appeared to abandon efforts to register them under EU rules, which mean they should seek asylum in the first EU country they enter.
About 1,000 migrants congregated outside Keleti station, in the east of the city, as it was evacuated on Tuesday.
It was closed briefly and public announcements said no trains would be leaving.
But it soon reopened to non-migrant passengers, with lines of police preventing migrants from entering the main entrance.
The move came amid chaotic scenes after hundreds of migrants had tried to board services to Austria and Germany.
Some complained that they had paid hundreds of euros for tickets, and called for the station to be reopened so that they could continue their journey.
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.
Many of the migrants have been waiting at Keleti (east) station for days. Reporters said they are mainly Syrians, Afghans and Eritreans.
Under the EU’s Dublin Regulation, asylum seekers must register in the first EU member state in which they arrive. However, the protocol has been widely abused, as many of those who reached Hungary first arrived in Greece, where they failed to claim asylum.
The Berlin government has already said it is suspending the Dublin rule for Syrians who have travelled to Germany.
Some 1,400 people had arrived in Munich by Tuesday morning, after travelling through Austria, and more were due.
German Chancellor Angela Merkel on Monday called for greater EU co-operation on the issue and implicitly called for other countries to welcome more refugees.
“If Europe fails on the question of refugees, then it won’t be the Europe we wished for,” she said.
The risks for migrants travelling through Europe were highlighted last week by the deaths of 71 people, who were found in a lorry that had travelled to Austria from Budapest.
Most of the dead were thought to be Syrians fleeing the country’s civil war.
Hundreds more people drowned in the Mediterranean last week while trying to reach Europe from Libya.