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, and 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 Ali Sonboly.
He has also been referred to as Ali David Sonboly, or David S.
He had an illegally held 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.
Friday evening's attack at the Olympia shopping mall also 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.
Authorities are also checking reports that he may have been bullied by his peers, Interior Minister Thomas de Maiziere said.
"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 attack and Friday's fifth anniversary of Breivik's attacks in Norway, when he murdered 77 people.
The killer reportedly shouted anti-foreigner slurs during the rampage and yelled "I'm German" at one man who challenged him.
Literature about mass killings was found at his home including a German-language translation of the book Why Kids Kill: Inside the Minds of School Shooters.
Mr De Maiziere said the suspect had researched a 2009 school shooting in Germany as well as the Breivik attack.
"There was material found in the apartment of the suspect that showed a particular interest in shooting sprees," he said.
Anders Behring Breivik
He 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.
Now 37, he is held in solitary confinement in Norway after being sentenced to 21 years in 2012. He recently won an appeal against the tough regime of his incarceration.
He harboured radical right-wing views and said his attack was aimed at stopping Muslim immigration to Europe.
First reports of the shooting came in just before 18:00 (16:00 GMT) 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 (half a mile) 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.
Were you in or near Munich's Olympia Mall at the time of the attack? Did you witness the shooting? If you are willing to share your story please email firstname.lastname@example.org
Please include a contact number if you are willing to speak to a BBC journalist. You can also contact us in the following ways. Please only contact us if it is safe for you to do so.