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 shot himself.

Munich police witnessed the suicide at 8:30 p.m. local time (1830 GMT), the police force said on Saturday.

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 to 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 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.

But he told German public television the government would look carefully at its security measures once the investigation was completed to see if any changes were needed.

De Maiziere said a unit of federal police had been readied on Friday given initial indications of a possible large militant attack, but in the end it was not used.

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.