German officials say they've arrested a man believed to have sold the weapon and ammunition used by a depression-plagued teenager who went on a rampage at a Munich mall that left nine people dead.

Prosecutors say the 31-year-old German was arrested in the western city of Marburg.

The Munich shooter, identified only as 18-year-old David S., opened fire with an illegal Glock 17 pistol on July 22, killing nine people and wounding dozens of others before killing himself.

He's believed to have purchased the weapon on the darknet, a restricted access computer network often used by criminals.

The connection to the shooter surfaced as authorities investigated the weapons dealer for other darknet sales.

Investigators have said the shooter was a victim of bullying who suffered from panic attacks and depression.