Crowds of migrants have been protesting outside Keleti train station in Hungary’s capital Budapest after police sealed off the terminal to stop them travelling through the EU.
Hundreds of people chanted “Germany” and waved train tickets after being forced to leave Budapest’s Keleti station.
Officials said Hungary was trying to restore order and enforce EU rules.
Austrian police said 3,650 migrants arrived in Vienna from Hungary on August 31, 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.
It was closed briefly and public announcements said no trains would be leaving.
The station 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 September 1, after travelling through Austria, and more were due.
German Chancellor Angela Merkel on August 31 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.