The teenager behind the deadly shooting rampage in Munich was a withdrawn loner investigators say, adding that he had planned the attack for a year.  Law enforcement officials said on Sunday 18-year-old David Ali Sonboly was obsessed with playing "killer" video games in his bedroom and a victim of bullying who suffered from panic attacks set off by contact with other people.  The German-Iranian was seeing a doctor up to last month for treatment of depression and psychiatric problems that began in 2015 with inpatient hospital care and then was followed up with outpatient visits.  Medication for his problems had been found his room but toxicological and autopsy results aren't yet available, so it's not yet clear whether he was taking the medicine when he went on his shooting spree on Friday, killing nine people and leaving dozens wounded.  The attack came on the fifth anniversary of the killing of 77 people by Norwegian right-wing extremist Anders Behring Breivik, whose victims included dozens of young people.  Investigators said the Munich shooter had researched that slaughter online and had visited the site of a previous school shooting in the German town of Winnenden last year.  "He had been planning this crime since last summer," said Robert Heimberger, Bavaria's top official, citing a "manifesto" linked to the shooting found in the gunman's locked room in the apartment he shared with his parents and brother.  Heimberger said he could not reveal details of the document yet because there were "many more terabytes" of information to evaluate, but described the gunman as a "devoted player" of group internet "killer games" pitting virtual shooters against each other.  Weapons are strictly controlled in Germany and police are still trying to determine exactly how the shooter obtained the Glock 17 used in the attack.  Heimberger said it's "very likely" the suspect purchased the weapon illegally online on the "darknet".  The shooter's father saw a video of the start of his son's rampage on social media and went to police as it was taking place, Heimberger said, adding that the family was still emotionally not up to questioning by police.  Witnesses say the gunman shouted slurs against foreigners, even though he himself was the German-born son of Iranian asylum-seekers  Heimberger said the McDonald's restaurant were most of the victims died was a hangout for youths of immigrant backgrounds, and the dead included victims of Hungarian, Turkish, Greek, and Kosovo Albanian backgrounds and a stateless person.  In the aftermath of the attack, Bavaria's top security official urged the government to allow the country's military to be deployed in support of police during attacks.  Because of the excesses of the Nazi era, Germany's post-war constitution only allows the military, known as the Bundeswehr, to be deployed domestically in cases of national emergency.  Munich deployed 2300 police officers to lock down the city Friday night, calling in elite SWAT teams from around the country and neighbouring Austria.
As German investigators piece together what was behind the Munich shooting, a picture of a withdrawn teenage loner, obsessed with violence, emerges.