The 18-year-old gunman who killed nine people in a shooting spree in Munich had been planning his crime for a year but chose his victims at random, officials said on Sunday.
"He had been preparing (the shooting) for a year," Bavarian police chief Robert Heimberger told a news conference.
Chief prosecutor Thomas Steinkraus-Koch added that he did not specifically choose his victims.
"It is not the case that he deliberately selected" the people who he shot, he said.
In total, 58 shell casings have been recovered from the crime scene, fired by a Glock 9mm pistol that David Ali Sonboly illegally acquired via the internet.
A further 300 bullets were found in his rucksack.
Sonboly was obsessed with Anders Behring Breivik, who massacred 77 people in Norway five years ago. But police also believe he was influenced by a previous shooting in Winnenden, south west Germany in 2009 when a 17-year-old shot 15 people in his former school before killing himself.
"Preliminary indications suggest that he was interested in that incident" and visited the site a year ago and took photos, said Heimberger.
He subsequently planned his own crime, he added.
Prosecutor Steinkraus-Koch said there was no indication that the shooting was politically-motivated or that he chose the victims because of their nationality.
The people who died had Hungarian, German-Turkish, Turkish, Kosovar or Greek nationality.
Heimberger noted that the area where the shopping mall was situated and the McDonald's outlet where Sonboly began his rampage were frequented by both foreigners and Germans with migrant backgrounds.
The attacker set up a fake Facebook account in May, stealing the profile of a real user and sending out invitations to lure people to the fast-food restaurant.
Police corrected earlier reports that Sonboly had hacked into an existing account.
But there was no evidence yet that any of the people who had interacted with Sonboly via the fake account had responded to the invitation in which he offered meals and drinks.
None of the people who died appeared to have interacted with him.
Sonboly appeared to have been the victim of bullying by fellow pupils back in 2012, filing a complaint against three of his tormentors.
But none of them were among the victims of the shooting.
Police found medical documentation in his room that suggested he suffered from anxiety attacks and "social phobias", particularly when it came to contact with others, prosecutor Steinkraus-Koch said.
He was admitted to hospital for two months in 2015 to receive treatment for his psychological problems after which he continued treatment as an outpatient.
Investigators found medication in his room but have so far been unable to ascertain whether he had been taking it on a regular basis.
Europe reacted in shock to the third attack on the continent in just over a week, after Sonboly went on a shooting spree at a shopping centre on Friday before turning the gun on himself.
Chancellor Angela Merkel said Munich had suffered a "night of horror".