Hundreds of migrants frustrated at being stuck at two train stations in Hungary have set off on foot for Austria.

One group formed a line nearly a half-mile long as they streamed out of Budapest, the other broke out of a train near a migrant reception centre and headed west after overwhelming police.

The moves for freedom came after Hungarian authorities spent days preventing thousands of people, many fleeing war in Syria, from boarding trains to Germany amid a surging number of desperate people from Asia, Africa and the Middle East seeking refuge in Europe. Hungarian state media called it "the day of uprisings".

Most hope to eventually reach Germany or elsewhere in the West and are trying to avoid registering in Hungary, which is economically depressed and more likely to return them to their home countries than many Western European nations. Under European law, asylum seekers will be approved or disapproved in the countries where they are first registered.

In Bicske, a town in northern Hungary, around 350 people broke through a police cordon and began heading to Austria 135km to the west on a train track leading away from the town's railway station, interrupting train traffic. Surprised riot police scrambled for their helmets as the huge crowd suddenly surged from the front of the train.

Police were able to block only a minority of the estimated 500 people inside, pushing them back onto the train amidst chaotic scenes.

Later, police began escorting the dozens who remained on buses, taking them to the migrant reception centre, amongst them many women and children.

Earlier, hundreds set out from the Keleti station in Budapest. With their belongings in bags and backpacks, they snaked through the streets of Budapest as they began the 171km journey to the Austrian border. By mid-afternoon they had reached the M1 motorway outside the city and by early evening they had covered about 20km.

Meanwhile the Hungarian parliament tightened its immigration rules, approving the creation of transit zones on the Hungarian border with Serbia where migrants would be kept until their asylum requests were decided within eight days. Migrants would have limited chance to appeal those decisions. It comes as Hungarian Prime Minister Viktor Orban ordered the erection of a barbed wire fence on the border with Serbia to stop the huge flow of migrants.

One man leaving Budapest on foot said he expects the journey to Austria to take three days. Osama Morzar, 23, from Aleppo, Syria, was so determined not to be registered in Hungary that he removed his fingerprints with acid, holding up totally smooth finger pads.

"The government of Hungary is very bad," said Morzar, who studied pharmacology at Aleppo's university. "The United Nations should help."

In Syria, a man whose family died when a small rubber boat capsized during a desperate voyage from Turkey to Greece buried his wife and two sons in their home town of Kobani. Photos of the lifeless body of Abdullah Kurdi's three-year-old son after it washed up on the beach drew the world's attention to the dangers faced by those fleeing war and poverty in the Middle East, Asia and Africa.

"He only wanted to go to Europe for the sake of his children," said Suleiman Kurdi, an uncle of the grieving father. "Now that they're dead, he wants to stay here in Kobani next to them."

Across Europe, the refugee crisis is becoming more dramatic.

In Geneva, the UN refugee agency said that nearly 5,600 people crossed from Greece to Macedonia a day earlier. That's roughly double the already high 2,500 to 3,000 per day in recent weeks.

"That is a dramatic number," said UNHCR spokeswoman Melissa Fleming.

Antonio Guterres, the head of the UN refugee agency, issued a statement urging the EU to create a "mass relocation program ... with the mandatory participation of all EU member states" for would-be recipients who clear a screening process.

He said a "very preliminary estimate" would be for the creation of at least 200,000 places to be added across the bloc.

But Mr Orban reiterated on Hungarian state radio his determination to stop the refugees.

"Today we are talking about tens of thousands but next year we will be talking about millions and this has no end.

"We have to make it clear that we can't allow everyone in, because if we allow everyone in, Europe is finished," he added. "If you are rich and attractive to others, you also have to be strong because if not, they will take away what you have worked for and you will be poor, too."

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.