German police have arrested an 18-year-old suspect who tried to buy a gun to carry out a shooting.

Authorities said Thursday the teenage male was arrested by a tactical weapons unit April 2 in Wiesbaden after officers lured him with a fake firearm.

The arrest followed a tip from "foreign law enforcement agencies" who warned German police that the teen wanted to buy a gun on the darknet — websites that are hidden from public view.

Police said there was evidence the suspect, a German-Iranian citizen, harbored "right-wing ideas" and may be suffering from mental illness. He told police he planned to kill people who were "mobbing" him.

In 2016, an 18-year-old of Iranian origin killed nine people and then himself in Munich using a gun bought on the darknet.