In pouring rain, they crossed the last few metres into Austria in the early hours of Saturday morning. The waiting Austrian police in their heavy waterproofs were taken aback by the refusal of the Hungarian bus drivers to take their passengers the last two kilometres over the border and on to the Nickelsdorf train station where they were expected, and where a Vienna-bound train was waiting.

Instead, the officers had to guide the way with torches, helpless to offer shelter to the tired clusters of men, women and children coming through the puddles at the side of the motorway in the darkness.

From 3am until early afternoon, some 120 blue buses had been and gone, disgorging an estimated 4,000 refugees. Some residents of the small border town of Nickelsdorf were at their windows, others out on the streets with blankets and umbrellas, offering hot drinks.

A Red Cross tent offered respite from the rain, with medics and volunteers working shifts while people waited for their turn to board special half-hourly bus and train services, laid on by the Austrian Federal Railway, to Vienna and Salzburg, and from there to Munich.

A boy who had arrived on a train from Hungary gets a kiss from a volunteer worker in Munich. Photograph: Sean Gallup/Getty Images

Several people were sent on to nearby hospitals, but Zenker said that most were “gritting their teeth” to continue their journey, despite some walking for almost eight hours through the night.

By midday on Saturday, a total of 3,000 people had arrived, said Colin Turner, volunteers’ spokesman at Munich railway station. German officials expected up to 7,000 to reach the city by the end of the day.

This, said the UN high commissioner for refugees, António Guterres, was a “defining moment” for the 28-nation European Union. Already the heroes and villains of the piece were being laid out – with condemnation of the response of the Hungarian prime minister, Viktor Orbán, and praise for Germany’s Angela Merkel and the Austrian chancellor, Werner Faymann, who announced they were opening their doors to refugees in the early hours of Saturday.

Around the same time, Hungary unexpectedly decided to provide buses for those who had simply walked out of Budapest on foot, heading for the Austrian border, after being prevented for several days from catching trains out of the capital. Some had been taken to a refugee camp.

In what the Hungarian media called a “day of uprisings”, 350 people had broken through a police cordon on Friday and begun heading to Austria, 85 miles (137km) away, on tracks leading away from the railway station. By late afternoon on Friday, a day after Orbán had warned of a “Muslim threat” to a Christian culture, up to 2,000 people – most from Syria, Iraq and Afghanistan – were walking towards the border in chaotic scenes.

Refugee children play at the Austrian-Hungarian border near the village of Nickelsdorf. Photograph: Joe Klamar/AFP/Getty Images

The sudden appearance of blue public buses was a staggering about-turn – and an unexpected rejection of the Dublin regulation, which says refugees seeking asylum should have their application assessed in the first EU country they enter, and which Hungary had insisted on upholding. The country is already under fire for its plans to close and wire-fence its borders, saying it will effectively seal the frontier to migrants as of next week, in the face of EU Schengen rules. The European Council president, Donald Tusk, warned that divisions between western member states and their newer eastern partners were complicating efforts to solve the deepening refugee crisis. “There is a divide … between the east and the west of the EU. Some member states are thinking about containing the wave of migration, symbolised by the Hungarian [border] fence,” Tusk said.

The buses triggered alarm. Many refugees distrusted the Hungarian authorities after some of those camped at Budapest railway station had earlier boarded buses that they were told were heading for the Austrian border, only to end up in a refugee camp in Hungary. Many feared a similar ploy this time. “Who’s organising it, the Hungarians?” asked Ali, a Syrian on the march, after seeing the buses were coming. “Forget it, I’m walking.”

But by the time the last buses arrived at 4.45am, almost everyone was too sodden and tired to worry about politicians’ motives. They squeezed on to the buses, standing in the aisles, sitting on the steps crushed against the doors. Within minutes, most were asleep. In Budapest, a handful of those who remained were reluctant to be processed in Germany because they wanted to join family members elsewhere. “I’m going to London on my own, my brother lives there and you can get a good job,” said Khan Mohammad, who comes from northern Baghlan province. Others had simply missed the convoy to the border.

On Saturday a column of several hundred new arrivals stormed through the station and on to the metro, saying they were heading for Germany. They piled back up the escalators when it emerged they had the wrong train system and on to the mainline platforms where warnings that international trains were not running had now been removed, although without any signs of the trains themselves.

“We must get to Germany,” said Suleiman, 23, from Gaza.

On the road to the border, there were tailbacks for eight kilometres, but many, like Marwan, didn’t mind. His view through the bus window was mainly of drizzle. He had walked for much of Friday in the rain, and he hadn’t slept all night. But by the time dawn rose on Saturday, he had cause to be cheerful. “Finally I’m getting out of Hungary,” he smiled. “I’m happy.”

In Austria, the mood was one of pride – for the way the government had responded to the crisis and for the overwhelming response from people ferrying donations of food, water and clothes to train stations in Vienna and Salzburg. By Saturday afternoon, officials in Vienna had to ask people to stay away from the station, which was heavily overcrowded with well-wishers bearing donations.

Hundreds of Austrian rail workers pledged to work overtime for free, to drive special refugee trains. Their boss, Christian Kern, called the situation “a huge challenge, a state of emergency”. He said the refugees’ train tickets would not be checked but that the goal was to take them as quickly as possible to their desired destination.

Some Austrians have been driving to the border in private cars and buses with the aim of giving refugees a lift to Vienna, but have been warned by the police not to cross into Hungary as they could be prosecuted there for people-smuggling. Austria’s foreign minister, Sebastian Kurz, said this weekend was a wake-up call for Europe. “This has to be an eye-opener as to how messed up the situation in Europe is now. I hope this serves as a wake-up call that it cannot continue.”

Stories such as the discovery of 71 decomposing bodies in a truck near Nickelsdorf last month and the tragedy of Aylan Kurdi, the three-year-old Syrian boy whose body was washed up on the Turkish coast on Wednesday along with his five-year-old brother and his mother, have horrified people all over the world. An even younger victim of the crisis emerged on Saturday night when a newborn boy was found dead after his parents reached the shores of a Greek island in a boat from Turkey. The baby boy was taken from the island of Agathonisi to a hospital on the nearby island of Samos, where he was pronounced dead, the Greek coastguard service said.

Chaotic and tragic scenes have been witnessed all over Europe but it was Hungary that became the focus of the refugee crisis with the arrival of about 50,000 migrants last month via the western Balkans, with a record 3,300 arriving on Thursday alone, according to UN figures. Hungary responded with tough anti-immigration measures, including its controversial three-metre razor-wire fence. Poor camp conditions and slow registration for asylum seekers have contributed to rising tensions at Hungary’s refugee facilities, but the country blames Germany, which expects to receive 800,000 asylum seekers this year, for declaring it would accept Syrian requests regardless of where they enter the EU.

“What happened is the consequence of the failed migration policy of the European Union and the irresponsible statements made by European politician,” the Hungarian foreign minister, Péter Szijjártó, said on Saturday.

A boy reacts as the train departs from Keleti railway station in Budapest. Photograph: Marko Drobnjakovic/AP

Hungary had also insisted there would be no more bus transports. On Saturday morning, in a park near Keleti station, a group of young men fretted about their next move. “We were sent to sleep in a hotel for one night after four nights on the street. I had no idea the government would send buses,” said Rahman, a 26-year-old Syrian from Aleppo, travelling with his wife, sister-in-law and two nephews. “We just wanted a break. Do you know if there will be another coach?” he asked anxiously.

A young Iraqi who had just arrived had not even heard about the coaches. “I just arrived a couple of hours ago. I have no idea about buses,” said Sajad al-Azawi, from Baghdad, who wants to be a computer scientist and is heading to Germany.

On Saturday night at Munich’s main station, dozens of Germans lined up behind police barriers to clap, cheer and distribute sweets to welcome refugees to their new home. A sophisticated official operation provided food and transport to temporary lodging.

“We just wanted them to know that the torture is over,” said Hedy Gupta, a grandmother handing out slabs of chocolate amid welcoming cheers. “I have children and a five-year-old grandchild and when I think what they have been through, these children, it leaves me on the ground.”

Beside her on the barricades of welcome was Waltraud Volger, a legal assistant who lives nearby: “I heard about it on the radio around 1pm today and just gathered what food and clothes I had and came over to donate it and offer to help,” she said. “They have so many volunteers that they haven’t needed me, so I’m just standing here welcoming them with clapping. I’ve never done anything like this before, but when you hear their stories and see the pictures, you can’t just stand by.”

After four hours, she had no plans to leave while the trains were still rolling in.