The 18-year-old gunman who killed nine people in Munich was obsessed with mass shootings but had no known links to the Islamic State group, German police say.
Written material on such attacks was found in his room. Munich's police chief spoke of links to the massacre by Norway's Anders Behring Breivik.
The gunman, who had dual German-Iranian nationality, later killed himself.
His name has not been officially released but he is being named locally as David Sonboly.
He had a 9mm Glock pistol and 300 bullets in his rucksack.
Police do not yet know how the weapon was acquired, but said he had no permit for it and the serial number had been obliterated.
They are investigating whether he may have lured his victims through a Facebook invitation to the McDonald's restaurant where he launched his attack on Friday evening.
The attack at the Olympia shopping mall left 27 people injured, including children. Ten of them are critically ill, including a 13-year-old boy, police say.
Seven of the dead were teenagers. Three victims were from Kosovo, three from Turkey and one from Greece.
Police say the Munich-born gunman had been in psychiatric care, receiving treatment for depression.
"We are in deep mourning... we share your grief", said Chancellor Angela Merkel after chairing a meeting of the national security council.
Flags are to be flown at half-mast across Germany.
People could be seen laying flowers and lighting candles outside the mall on Saturday. One placard left there simply asked "Why?"
Munich police chief Hubertus Andrae said there was an "obvious" link between the new attack and Friday's fifth anniversary of Breivik's attacks in Norway, when he murdered 77 people.
Mr Andrae warned the number of injured could increase if people who had fled the scene came forward.
First reports of the shooting came in just before 6pm (local time) on Friday.
Witnesses say the attacker opened fire on members of the public in Hanauer Street before moving on to the mall.
A grainy video appears to show a man firing a gun outside McDonald's as people flee.
Another video shows the gunman walking around alone on a flat roof before again opening fire. He can be heard shouting at the person filming, saying at one point, "I'm German".
Witness Luan Zeqiri, who was in the shopping centre, told German broadcaster N-TV the attacker had been wearing military-style boots and a backpack.
"I looked in his direction and he shot two people on the stairs," he said.
Mr Zeqiri said he hid in a shop, but when he left, he saw dead and wounded people on the ground.
Police said the gunman's body was found about 1km from the mall.
His parents had come to Germany in the late 1990s as asylum seekers, Interior Minister Thomas De Maiziere said.
Police have ruled out any connection to the self-styled Islamic State (IS) group.
Fears of a new IS attack had been high just four days after a teenage Afghan asylum seeker stabbed and injured five people on a train in Bavaria before being shot dead by police.
Claiming the attack, IS later released a video showing the 17-year-old brandishing a knife and making threats.
Anders Behring Breivik, which the latest gunman is said to have links to, murdered 77 people in Norway on 22 July 2011, killing eight with a bomb in the capital Oslo before shooting dead 69 at a summer camp for young centre-left political activists on the island of Utoeya.