The teenager who shot dead nine people in a gun rampage in Munich was "obsessed" with mass killers like Norwegian rightwing fanatic Anders Behring Breivik and had no links to the Islamic State group, police said Saturday.
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 swear 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.
Neighbours said Sonboly was born to Iranian parents, a taxi driver father and a mother who worked at a department store. They arrived in Germany as asylum seekers in the late 1990s.
Of Shiite Muslim origin, Sonboly appears to have converted to Christianity, hence his first name David.
The family lived in the well-heeled Maxvorstadt neighbourhood in a tidy social housing block popular with immigrant families.
Neighbour Delfye Dalbi, 40, described Sonboly as a helpful young man who was "never bitter or angry", though others remembered a quiet loner.
A former classmate told Britain's ITV News that she had run into Sonboly just hours before the attack.
"He seemed like he was worried. He was weird. He didn't look at me. He usually looks at me and says hello," she said.
A police source cited by DPA news agency said he loved playing violent video games and was an admirer of the 17-year-old German who shot dead 15 people at his school near Stuttgart in 2009.
Andrae of the Munich police said the teenager had been obsessed with books and articles about mass killings "linked to maniacs".
De Maiziere told reporters that Sonboly had likely used a hacked Facebook account to lure people to the McDonald's branch, "offering them special reductions".
The casualties were mostly young, with three aged just 14 and two aged 15.
Most of the victims in Friday's attack were foreigners, including three Turkish nationals, three people from Kosovo and a Greek.
Eiffel Tower lit up
US President Barack Obama voiced staunch support for Washington's close ally Germany, while EU foreign policy chief Federica Mogherini said: "Europe stands united."
Europe has been on high alert for terrorism after a string of attacks in neighbouring France and Belgium claimed by IS.
The attack came just four days after a 17-year-old asylum seeker went on a rampage with an axe and a knife on a train in Bavaria, injuring five people.
It also came just over a week after a Tunisian used a truck to mow down 84 people after a Bastille Day fireworks display in Nice, the third major attack on French soil in the past 18 months.
The Eiffel Tower in Paris was lit up in the colours of the German flag late Saturday in tribute to the Munich victims.