A German-Iranian teenager who killed nine people and then himself in Munich had undergone psychiatric treatment and was in all probability a lone gunman who had no Islamist militant ties, police said on Saturday.
The 18-year-old, who was born and raised locally, opened fire near a busy shopping mall on Friday, triggering a lockdown in the Bavarian capital in the third act of violence against civilians in Western Europe - and the second in southern Germany - in eight days.
Seven of his victims were themselves teenagers, police said, and Bavarian state crime office president Robert Heimberger said the gunman 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, in which a further 27 people were wounded - including some hurt when panic spread.
"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.
Bavarian State premier Horst Seehofer said the killings in Munich and 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 shaken Seehofer told reporters.
He was speaking just over a week after the Bastille Day massacre by a truck driver in Nice. Both the Nice rampage, which killed 84, and the Wuerzburg attack were claimed by Islamic State.
Chancellor Angela Merkel was meeting with her top security advisors to review Friday's attack and would issue a statement at 1230 GMT, her office said.
'WHY KIDS KILL'
The Munich gunman, whose body was found on a side street near the mall, was not identified but police said he had no criminal record but he was a victim of two minor crimes -- a theft in 2010 and bodily harm in 2012.
Police commandos, armed with night vision equipment and dogs, had raided an apartment in the Munich neighbourhood of Maxvorstadt early on Saturday where the German newspaper Bild said the gunman lived with his parents.
"Documents on shooting sprees were found so the perpetrator obviously researched this subject intensively," Andrae said.
In the killer's room police found a German translation of a book entitled "Why Kids Kill -- Inside the Minds of School Shooters".
The investigations gave no reason to believe the killer had had an accomplice, Andrae said, adding the teenager was born and brought up in the Munich area and had spent time in psychiatric care.
Asked if the shooter had deliberately targeted young people, Munich police chief Andrae said that theory could be neither confirmed or ruled out.
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 got the firearm used in the attack in a country whose gun control system is described by the U.S. Congress Library 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.
There was a huge police presence outside the gunman's home just north of Munich's old city.
"I am shocked, what happened to the boy? Only God knows what happened," Telfije Dalpi, a 40-year-old Macedonian neighbour of the family told Reuters. "I have no idea what happened... I have no idea if he did anything bad elsewhere."
In Pristina, media said three of the 18-year-old's victims were of Kosovan origin. Naim Zabergja, the father of one of the victims wrote on Facebook: "With great sadness I want to inform you that my son Dijamant Zabergja, 21, was killed yesterday in Munich."
A second victim was named by her brother on Facebook as Armela Segashi, who he said died along with a third, Sabina Sulaj.