The teenager, who carried out the shooting spree in Munich killing nine people, was obsessed with mass killers like Norwegian far-right terrorist Anders Behring Breivik, who committed the 2011 Norway attacks, and had no links to the Islamic State group, police said.
Europe reacted in shock to the third attack on the continent in just over a week, after 18-year-old David Ali Sonboly went on a shooting spree at a shopping centre on Friday in what appears to have been a premeditated attack, before turning the gun on himself.
Officials said Sonboly, a German-Iranian student, had a history of mental illness.
Interior Minister Thomas de Maiziere said the teenager had likely hacked a girl's Facebook account and used it to lure victims to the McDonald's outlet where he began his rampage.
"There is absolutely no link to the Islamic State," Munich police chief Hubertus Andrae said, with prosecutors describing the assault as a "classic act by a deranged person".
Investigators see an "obvious link" between Friday's killings and Breivik's massacre of 77 people in Norway exactly five years earlier, Andrae added.
Chancellor Angela Merkel said Munich had suffered a "night of horror".
Most of the victims in Friday's attack were young people, with three aged just 14, police said. Munich prosecutor Thomas Steinkraus-Koch said Sonboly had suffered depression, but voiced caution over reports he may have undergone psychiatric treatment.
The teenager had 300 rounds of ammunition in a rucksack when he targeted the busy Olympia shopping mall, just minutes away from the flat he shared with his family, according to authorities.
Police are investigating how he managed to obtain his weapon, a 9mm Glock pistol with a defaced serial number.
Germany's bestselling Bild newspaper pointed out that a Glock pistol was also among the firearms used by Breivik. In the grieving city of Munich, residents laid roses and lit candles in memory of the victims, with one placard bearing the simple plea: "Why?" Sixteen people were wounded in the attack, three of them critically.
Survivors described terrifying scenes Friday as shoppers rushed from the area, some carrying children in their arms.
A video posted on social media appeared to show a man in black walking away from the McDonald's restaurant while firing a handgun as people fled screaming.
Other footage also emerged, apparently showing the gunman on a car park roof in a heated exchange with a man on a nearby balcony.
"I'm German, I was born here," the assailant replied after the man fired off a volley of swears words.
A police patrol shot and wounded Sonboly but he escaped before police found his body, after an operation to track down what had initially been thought to be up to three attackers.
(With PTI inputs)