• Ali Sonboly carried out deadly spree on anniversary of Utøya massacre • Gunman apparently used hacked Facebook page to lure victims • Police attempt to trace Glock semi-automatic pistol used by attacker

The German 18-year-old who killed nine people at a Munich shopping centre on Friday night was obsessed with mass killings, owned a book on US school shootings and played computer shooting games.

Most of his victims were fellow teenagers, five of them under 16. The loss of so many young people added to the depth of mourning in Germany, where people are struggling to understand how a shy student managed to acquire a gun and bullets and then turn them on his peers in cold blood.

Germany and gun laws: a chequered history Read more

The attacker, named as Ali Sonboly, was the son of Iranian refugees who came to Germany in the 1990s. Neighbours said he was shy and withdrawn and showed no signs of the violence that had apparently preoccupied him long before Friday night. A police search of the gunman’s family home, part of a social housing block in the prosperous Maxvorstadt district, found newspaper clippings and books related to mass murders, among them one called Why Kids Kill: Inside the Minds of School Shooters.

“[He] was obsessed with shooting rampages,” Munich’s police chief, Hubertus Andrae, said. Sonboly also seems to have been interested in the far-right terrorist Anders Breivik, who murdered 77 mostly young people in a killing spree across Oslo and an island camp. The Munich attack came on the fifth anniversary of the Norwegian slaughter. A classmate told Germany’s Bild newspaper that Sonboly used Breivik’s face as his profile picture on the WhatsApp messaging service.

Sonboly apparently tried to lure his victims to the site of the massacre with a bizarre message on a hacked Facebook page, promising free meals to anyone at the restaurant at 4pm. It was a venue the gunman knew, police believe, and he may have recognised victims, although he did not begin shooting until two hours after the Facebook invitation.

One of the questions facing authorities is whether Sonboly, who was bullied and isolated at school, intentionally set out to kill other young people. The dead included seven teenagers, a 20-year-old and a 45-year-old woman.

Germany has a grim track record of attacks on young people, with two teenagers returning to their schools to launch massacres in the last 15 years, one in 2002 and a second in 2009.

‘Strange and withdrawn’: what drove Ali Sonboly to launch Munich massacre? Read more

The DPA news agency said it found evidence that Sonboly had idolised Tim Kretschmer, who in 2009 killed 15 people in the town of Winnenden, in a neighbouring state. The 17-year-old had returned to his former school and opened fire, shot several other people while fleeing police and killed himself.

In 2002 in the city of Erfurt a 19-year-old had also entered his former school and killed 11 teachers, two other school employees, two students and a policeman. At the time security forces were criticised for their slow response.

Police spokesman Peter Beck said officials don’t yet know what triggered the attack in Munich but that there was no clear political motivation. Searches had revealed no links to terror groups and he suggested the attack was unlikely to have been driven by Islamist extremism.

Chancellor Angela Merkel vowed that authorities would determine why the 18-year-old had carried out the killings. The chancellor said Germany was in deep and profound mourning for those who would never return to their families: “We share in your grief – we think of you and are suffering with you,” she said.

The dead included three children from Turkey, three ethnic Albanians from Kosovo and at least one Greek teenager. Tributes to the dead poured in from across Europe, with flags flying at half-mast across Germany.

Security forces are trying to trace the Glock semi-automatic pistol used by Sonboly, who probably bought it through the black market as he did not have a licence, and initial reports say the gun had its serial number erased and may once have been deactivated.

The teenager was not on the radar of security forces as he did not have a criminal record and had never attracted the attention of intelligence agencies, said interior minister Thomas de Maizière.

What's the mood in Germany following the recent attacks? Read more

Germans took some comfort amid the horror from video footage of a man confronting Sonboly as he paced a carpark roof near the site of the massacre. Thomas Salbey told Bild that he was having a beer when he heard shots. “I looked down from my balcony and saw how the man went through the glass entrance-way. He had reloaded his pistol. I threw my beer bottle at him. It shattered on the glass roof. But I think he didn’t hear it anyway,” Salbey said.

When Sonboly appeared on the carpark roof, Salbey shouted at him: “Arsehole.” He also said: “Are you crazy!” and “Fucking foreigners”. The gunman answered: “I’m German,” to which the reply came: “You’re a wanker is what you are.” The man then fired at Salbey, whose balcony is flecked by bullet holes. He took cover, but called out to police arriving below that the gunman was on the roof. “I was not scared. I didn’t know whether they were real bullets or just rubber bullets,” he said.