The teenager who shot dead nine people at a Munich shopping mall spent a year planning the rampage but selected his victims at random, officials said today.
Details are emerging of gunman David Ali Sonboly as a depressed 18-year-old who was obsessed with mass killings and had long struggled with his mental health.
Friday's shooting spree sparked a terror alert, with Europe on edge following a string of attacks claimed by the Islamic State group, but investigators have ruled out that Sonboly had any link with the jihadists.
However, he appears to have planned the assault with chilling precision, with Bavarian police chief Robert Heimberger telling a press conference today that Sonboly had visited the site and taken photos during a year of preparation.
Chief prosecutor Thomas Steinkraus-Koch added that the gunman had not "deliberately selected" his victims, dismissing speculation that Sonbaly sought to target foreigners.
Most of the dead -- who were mainly teenagers -- were foreign nationals. They included a Turk, two Turkish-German dual nationals, a Hungarian, a Kosovan and a Greek, according to police.
Sonboly killed himself after his murderous spree with the 9 mm Glock pistol he had bought on the internet.
His attack, which began at a McDonald's branch, also left 35 people injured.
'Munich attacker- a victim of bullying'
Steinkraus-Koch said Sonboly had spent two months in a psychiatric unit last year. He suffered anxiety attacks and "social phobias", according to documents found in his bedroom.
Police also found medication, but it was not clear whether he had been taking it. He had continued treatment as an outpatient after his release from hospital.
He also appeared to have been a victim of bullying by other pupils at his school, filing a complaint against three of his tormentors in 2012.
But none of these youngsters were among the shooting spree victims, police stressed.
They added there was no evidence that any of the dead were lured to the McDonald's branch by promises of discounts that Sonboly had sent out from a fake Facebook account, an act interior minister Thomas de Maiziere has described as "particularly underhand".
Sonboly was obsessed with Anders Behring Breivik, whose massacre of 77 people in Norway came exactly five years before his own shooting spree.
But police also believe the teenager was influenced by a previous shooting in Winnenden, southwest Germany in 2009, when a 17-year-old shot 15 people in his former school before killing himself.
Born to Iranian parents who came to Germany in the 1990s as asylum-seekers, Sonboly lived in social housing in Munich's well-heeled Maxvorstadt neighbourhood.
Video footage from Friday apparently shows Sonboly on a car park roof in a heated exchange with a man on a nearby balcony.
"I'm German, I was born here," the black-clad assailant replies after the man swore at him, using curse words for foreigners.
Of Shiite Muslim origin, Sonboly appears to have converted to Christianity.