Updated

Confusion reigned at Budapest's main railway station Thursday morning after Hungarian police allowed hundreds of migrants to enter the building, but the country's railway operator said that no direct trains would depart for Western Europe, the intended destination for many refugees.

A Reuters photographer estimated that up to 1,000 migrants from the Middle East, Africa and Asia had poured into the Keleti railway station from the square outside. The photographer also reported that some people had stormed the first trains they could find and were trying to push themselves and their children into the carriages through the doors and windows.

The Associated Press reported that announcements were made over the station loudspeakers in several languages, including English, that the trains were not heading west. Some migrants could be seen getting off the domestic trains, while others remained on the carriages amid the confusion.

A train that managed to leave the station, which was  bound for a town called Sopron, was stopped by police about an hour from Budapest, The Guardian reported. The passengers were ordered to get off the train. Some of the passengers grabbed hold of the train track to prevent police from taking them to a refugee camp.

Some reportedly banged on windows, chanting, "No camp, no camp."

More On This...

    Some of the migrants had been forced to sleep in the streets of Budapest for two nights after Hungarian police closed the terminal to them Tuesday. At that time, migrants with valid tickets but no travel documents were prevented from boarding trains to Austria and Germany.

    There was no immediate explanation from the police or other authorities about why the migrants were allowed to enter the terminal Thursday. The rail company said its stance was due to "railway transport" security reasons. A Hungarian government spokesman confirmed to Sky News that no international trains would be leaving the station for "safety reasons."

    Later Thursday, Hungarian Prime Minister Viktor Orban said his country's military would be deployed at the country's southern border with Serbia as part of a crackdown on migrants and human traffickers.

    Orban told the Associated Press in Brussels that Hungarian parliament is pushing through new measures "that will create a new legal situation at the borders, even more strict than it was." He added that the migrant "problem is not a European problem, the problem is a German problem, nobody would like to stay in Hungary ... all of them would like to go to Germany."

    More than 160,000 migrants have crossed into Hungary this year as members of the 28-nation E.U. squabble over how to deal with its worst humanitarian crisis since the end of World War II.

    On Wednesday, the leaders of Germany, Italy and France called for a "fair distribution" of refugees throughout the E.U. Germany alone is expected to take in 800,000 migrants this year, four times more than its 2014 total. Meanwhile, Italy and Greece, which have had to deal with an increase in migrants attempting the dangerous Mediterranean Sea crossing, have complained that their resources are being overwhelmed by the sheer numbers.

    The crisis was given new urgency on Wednesday when images of a drowned three-year-old boy whose body had washed up on the shore of Turkey's Bodrum peninsula spread rapidly on social media. Turkish authorities said the boy was one of 12 Syrians who had drowned trying to reach Greece when the boat they were traveling in sank. The boy's mother and five-year-old brother were also among the victims.

    Back in Hungary, migrants had threatened Wednesday to walk the 105 miles to the Austrian border if police would not let them board trains to their desired destinations.

    Hungary tantalizingly opened the way Monday, allowing more than 1,000 migrants to pack westbound trains -- and inspiring a migrant surge to the capital -- before it withdrew the option 24 hours later.

    Hungary, which for months had permitted most applicants to head west after short bureaucratic delays, now says it won't let more groups deeper into the European Union and claims EU backing for the move.

    With an estimated 3,000 people camping outside the station, conditions had grown increasingly squalid despite the efforts of volunteers distributing water, food, medicine and disinfectants.

    The Associated Press contributed to this report.