MUNICH (AFP) - A teen gunman who killed nine people in a rampage in Munich was "deranged", police said on Saturday (July 23), linking his actions to Norwegian far-right mass murderer Anders Behring Breivik rather than Islamic State extremists.

Europe reacted in shock to the third attack on the continent in just over a week, after the black-clad gunman went on a shooting spree at a shopping mall on Friday evening before committing suicide.

"There is absolutely no link to the Islamic State," Munich police chief Hubertus Andrae said.

He describing the attack as a "classic act by a deranged person" and described an individual "obsessed" with mass shootings.

Andrae added: "The link is evident" with Breivik's massacre of 77 people, which took place exactly five years ago to the day.

Munich prosecutor Thomas Steinkraus-Koch said the 18-year-old German-Iranian - whose name has been withheld for the time being - had suffered depression and reportedly undergone psychiatric treatment.

Grieving Munich residents laid roses and lit candles in memory of the victims, with one placard bearing the simple plea: "Why?"

"Bloodbath in Munich," was the headline on the best-selling Bild newspaper as Germany struggled to come to terms with the killings.

The attack had sent Germany's third largest city into lockdown as police launched a massive operation to track down what had initially been thought to be up to three assailants.

Chancellor Angela Merkel was to convene her security council on Saturday to address the shooting.

The incident occurred four days after an axe rampage on a train in the same German state of Bavaria and eight days after a truck attack in the French Riviera city of Nice that killed 84 people. Both assaults have been linked to jihadism.

Armed with a handgun, the attacker opened fire at a McDonald's restaurant and continued along the street before entering the mall.

A police patrol shot and wounded the gunman but he managed to escape before police found the body of what they believed was the "only shooter." Among the nine killed were three Kosovans, according to the foreign ministry in Pristina, while Munich police said the injured included children.

A video posted on social media appeared to show a man in black walking away from a McDonald's while firing repeatedly on people as they fled screaming.

Survivors described terrifying scenes as shoppers rushed from the area, some carrying children in their arms.

"We entered McDonald's to eat... then there was panic, and people ran out," one woman told Bavarian television.

Another video appeared to show the gunman on a car park roof exchanging a tirade of insults with a man on a nearby balcony.

"I'm German, I was born here," the assailant replies after the man fired off a volley of swear words, including an offensive term for foreigners.

Police initially believed there could be up to three assailants.

But Andrae later said two others had "absolutely nothing to do" with the attack - and that they were simply fleeing the scene.

Munich's main train station was evacuated and metro and bus transport suspended for several hours while residents were ordered to stay inside, leaving the streets largely deserted.

President Joachim Gauck said he was horrified by the "murderous attack", while US President Barack Obama voiced staunch support for Washington's close ally.

"Our thoughts are with the victims, their families, and all German people. Europe stands united," EU foreign policy chief Federica Mogherini said on Twitter.

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 days after a 17-year-old asylum seeker went on a rampage with an axe and a knife on a train on Monday near Wuerzburg, also in Bavaria, injuring five people.

Interior Minister Thomas de Maiziere had said that assailant was believed to be a "lone wolf" who appeared to have been "inspired" by ISIS but was not a member of the jihadist network.

On July 14, 31-year-old Tunisian Mohamed Lahouaiej Bouhlel used a truck to mow down 84 people, including children, after a Bastille Day fireworks display in Nice, the third major attack on French soil in the past 18 months.

Friday's massacre spurred many in Munich to think the unthinkable.

"It has reached us. People in Munich have long had a queasy feeling. Fears grew with every attack in Paris, Istanbul or Brussels," said the Abendzeitung newspaper's editor-in-chief Michael Schilling.

"There were particular concerns about the Oktoberfest. But since Friday it is clear that there can be no security anywhere, not even in the safest German city." The train attack had already triggered calls by some politicians to impose an upper limit on the number of refugees coming into Germany, which accepted a record 1.1 million migrants and refugees last year, many through Bavaria.