Photo: AP

Officials say the 18-year-old German-Iranian man who killed nine people in Munich on Friday before turning the gun on himself was “obsessed” with shooting rampages and apparently spent a year planning his attack, The Guardian reports.

According to Bavarian state police, the gunman identified as David Ali Sonboly visited the site of a school shooting last summer and likely bought the gun illegally online. From CNN:

On Sunday, investigators revealed he left behind a long written statement on his computer, which was still being analyzed. They said they found photographs on his camera showing he visited the German town of Winnenden, the site of a deadly 2009 school shooting.

Earlier, officials said they found in the gunman’s belongings numerous documents on mass killings, including a book entitled “Rampage in My Mind — Why Students Kill.”

Officials believe there likely was significance in the timing of the attack, which came five years to the day since Anders Behring Breivik killed 77 people in Norway in 2011, many of them attendees at a youth camp.

Although himself the son of Iranian asylum seekers, Sonboly reportedly yelled “anti-immigrant slurs” and shouted “I will kill you all” during his attack. A 16-year-old who knew the gunman from playing Counter-Strike online told Der Speigel Sonboly was “very nationalistic” and frequently made xenophobic comments about Turks.

“We always expected something like what happened,” said the teen, according to Reuters, “but we never thought he could get a gun and then use it.”