A German-Iranian teenager who shot dead nine people in Munich was a deranged lone gunman obsessed with mass killings who drew no inspiration from Islamist militancy, police said on Saturday.
The 18-year-old, born and raised locally, opened fire near a busy shopping mall on Friday evening, triggering a lockdown in the Bavarian state capital.
Seven of his victims were themselves teenagers, who police said he may have lured to their deaths via a hacked Facebook account on what was the fifth anniversary of twin attacks by Norwegian mass murderer Anders Breivik that killed 77 people.
The Munich shooting, in which a further 27 people were wounded, some seriously, was the third act of violence against civilians in Western Europe - and the second in southern Germany - in eight days.
Bavarian state crime office president Robert Heimberger said the gunman, who German media named as Ali David Sonboly, was carrying more than 300 bullets in his backpack and pistol when he was later found dead of a gunshot wound.
Following a police search of the attacker's room, where a book on teenage shooting sprees was discovered, Munich police chief Hubertus Andrae all but ruled out an Islamist militant link in the attack.
"Based on the searches, there are no indications whatsoever that there is a connection to Islamic State" or to the issue of refugees, he told a news conference.
"Documents on shooting sprees were found, so the perpetrator obviously researched this subject intensively."
The gunman was born and brought up in the Munich area and had spent time in psychiatric care, and there was no evidence to suggest he had an accomplice, Andrae said.
Interior Minister Thomas de Maiziere said it was also too early to associate the Munich shootings with Breivik, who in 2011 shot dead 69 attendees at a youth summer camp hours after murdering eight others by detonating a van bomb in Oslo.
Robert Heimberger, president of the Bavarian state criminal agency, told the news conference police were investigating findings suggesting the Munich gunman invited people to a fast food restaurant at the mall via the Facebook account.
"(He) said he would treat them to what they wanted as long as it wasn't too expensive - that was the invitation," Heimberger said. He added that this still needed to be verified, but there were many clues suggesting the attacker had set up the invitation and sent it or posted it online.
Turkey's foreign minister said three Turkish citizens were among nine people killed in the Munich attack while Greece's foreign ministry said one Greek was among the dead. According to foreign media reports, there were also three Kosovo Albanian victims.
Chancellor Angela Merkel said she was "mourning with a heavy heart" for those killed, and that the security services would do everything to ensure the public was safe.
Police stand guard outside the Olympia shopping mall, where yesterday's shooting rampage started, in Munich, Germany July 23, 2016.
Bavarian Premier Horst Seehofer said the killings - together with an axe attack by a 17-year-old asylum-seeker that injured five people in Wuerzburg, also in Bavaria, on Monday - should not be allowed to undermine democratic freedoms.
"For the second time in a few days we've been shaken by an incomprehensible bloodbath ... Uncertainty and fear must not be allowed to gain the upper hand," a visibly distressed Seehofer told reporters.
Both the Wuerzburg attack, and the Bastille Day rampage by a truck driver in Nice, France that killed 84 people on July 14, were claimed by Islamic State militants.
'Why kids kill'
The Munich gunman, whose father a neighbour said had worked as a taxi driver, had no criminal record but had been a victim of theft in 2010 and assault in 2012, police said.
De Maiziere said there were indications the killer had been bullied "by others his age".
Police commandos, armed with night vision equipment and dogs, raided an apartment in the Munich neighbourhood of Maxvorstadt early on Saturday, where a neighbour told Reuters the gunman had lived with his parents for about four years.
In the killer's room, police found a German translation of a book entitled "Why Kids Kill - Inside the Minds of School Shooters".
Asked if the gunman had deliberately targeted young people, Munich police chief Andrae said that theory could be neither confirmed or ruled out.
Bavarian Interior Minister Joachim Herrmann said there were several signs he had been suffering from "not insignificant psychological troubles."
Three of his victims were 14 years old, two were 15, one was 17 and one 19. The others were 20 and 45, the police chief said.
Police will also have to find out how the 18-year-old obtained the firearm in a country whose gun control system is described by the U.S. Library of Congress as being "among the most stringent in Europe".
"The investigation is still trying to determine where it came from," Heimberger said, adding that the assailant was not the registered owner of the gun.
"I am shocked. What happened to the boy? Only God knows what happened," Telfije Dalipi, a 40-year-old Macedonian neighbour, told Reuters. "... I have no idea if he did anything bad elsewhere."