German police have arrested an Afghan teenager on suspicion of a connection to the killing of nine people by an 18-year-old gunman in Munich, authorities said. 

The 16-year-old was under investigation for possibly having failed to report the plans of the gunman, David Ali Sonboly, who later shot and killed himself, a police statement said on Sunday. 

"There is a suspicion that the 16-year-old is a possible tacit accomplice to [Friday's] attack," the police said.

The teenager reported to police immediately after the shooting and was interviewed, but investigators later uncovered contradictions in his statements.

READ MORE: Munich attack - Suspect 'obsessed' with mass shootings

He is also being investigated for his possible involvement in a Facebook post inviting people to meet at a cinema complex near the main railway station in Munich.

The gunman had lured people to the McDonald's restaurant, where the shooting began on Friday, using a fake Facebook page he had created in May.

Sonboly, a Iranian-German teen, was "deranged" and "obsessed" with mass shootings but had no political motivation behind the attack, police said. 

He had planned his attack for a year and chose his victims at random, according to investigators.

The attack sent Germany's third largest city into lockdown as police launched a massive operation to track down what had initially been thought to be up to three assailants.

The Munich assault has sparked a debate about whether Germany's strict gun laws should be tightened further, and the fact that Sonboly was able to acquire the pistol online will raise questions over how to stop others from doing the same.

The attack came just four days after a 17-year-old asylum seeker went on a rampage with an axe and a knife on a train in Bavaria, injuring five people. He was believed to be a "lone wolf" Afghan or Pakistani inspired by the Islamic State of Iraq and the Levant (ISIL, also known as ISIS)

Source: Agencies