Munich gunman had been planning attack for a year - police

Authorities believe the gun used in the rampage was purchased on the dark web

Munich gunman had been planning attack for a year - police

Special forces police enter the Olympia mall in Munich after shots were fired | Image: Sebastian Widmann/AP/Press Association Images

Munich killer David Ali Sonboly bought the gun used in his rampage on the dark web and had been planning the attack for a year, according to German authorities.

Police said the Glock 17 pistol used by the 18-year-old to kill nine people had its serial number scratched off but appeared to have originated in Slovakia and had been reactivated.

Police confirmed Sonboly had lured his victims to a shopping centre McDonalds using a fake Facebook account but said the victims - most of them teenagers - were not classmates of the gunman.

Bavarian prosecutor Thomas Steinkraus-Koch said: "It is not the case that he deliberately selected."

Thirty-five people were injured in the shooting spree, with 10 severely injured and three in a critical condition, police said.

Investigator Robert Heimberger said Sonboly's planning involved visiting the site of a previous school shooting in Winnenden, where he took photographs.

He was also an avid player of first-person shoot-em-up video games, including 'Counter-Strike: Source'.

Authorities said there was no evidence of any political motivation for the crime and confirmed that Sonboly had been treated for mental health problems.

Mr Steinkraus-Koch said Sonboly feared contact with others and had depression and that he had been treated as a psychiatric inpatient for two months in 2015.

Police have been probing claims that the killer felt bullied by his peers and that he may have been inspired by Norwegian mass murderer Anders Breivik, who killed 77 people exactly five years before the Munich shootings.

A search of his room revealed he was obsessed with mass killings and he had warned a 14-year-old girl living in his apartment block, "I will kill you all," just weeks before the shooting.

Mr Heimberger said German-Iranian Sonboly's parents were still in shock and detectives had not yet had a chance to interview them.