Almost as soon as police shut down public transport on Friday evening in an effort to prevent suspects from slipping through the net, people took to social media to offer help to the stranded.
Under the hashtag #offenetuer ('open door'), people could seek refuge until the transport network was back up and running -- an approach also seen in France after the Paris and Nice attacks.
"We have beer and a place to sleep near Prinzregentenplatz/Max Weber Platz. DM (direct message) me!" tweeted one user, @JoTaucher.
Merkel said the generosity of Munich residents showed that "we live in a free society and it showed humanity", adding that "our greatest strength" lies in these values.
"The people of Munich have come through a night of horror," she said.
Germany's third-largest city is reeling after David Ali Sonboly, an 18-year-old German-Iranian, killed nine people and injured 16 others in a busy shopping mall before committing suicide.
Initially there were reports of three possible attackers, but by Friday night police had ruled that out and said Sonboly acted alone.
The 'open door' initiative found widespread praise among German authorities and the press.
"This solidarity impressed me deeply. It was a good sign of a civil society," Bavaria's finance minister Markus Soeder told reporters.
"Amongst all the shock and mourning, there is still hope."
The local daily Abendzeitung was similarly moved.
"On an evening where the city descended into panic and Munich's population fled in sheer terror from public spaces, restaurants and beer gardens, a great many spontaneously offered refuge," it wrote in a leader column.
A young woman who gave her name as Tamara told AFP that she and her family were shopping in the OEZ mall when the shooting began.
She and her Turkish husband, with their children aged two and four, found themselves with nowhere to go because the nearby street where they lived had been cordoned off.
"It all happened so quickly. We only realised what was going on when we saw the TV reports. We were ordered to leave the mall as quickly as possible and we first thought it was a false alarm," she explained.
"But then we saw everyone else running, too."
When the young family realised they could not go home, they took shelter in a nearby tower block.
"We got into the lift and rode up to the 14th floor and rang on the doorbell. There was a pram in front of the door, so we thought, OK, if someone's going to open the door, it'll be another family.
"We've got children, too, as you see. But we didn't know them."
The family invited them in and let them stay.
In the city centre, hotels also offered shelter to anyone stranded, allowing them to remain in the lobby if all the rooms were booked.
The mall was still heavily cordoned off on Saturday as forensic experts scoured the site, but people were already laying flowers and lighting candles for the dead.
One hand-written placard asked simply "Why?"
Meszaros, a 78-year-old Hungarian, said he had lived in the area for more than 40 years.
"What goes through the mind of someone like that?" he asked. "What are his friends and family feeling and thinking?"
He had heard reports that the gunman had dual German and Iranian nationality.
"That means he grew up here. Did he just flip or were there political reasons?" Meszaros asked.
"Nothing like that has ever happened here before. It's inconceivable."