FRANKFURT (Reuters) - A German man who admitted selling the weapon a teenage gunman used to killed nine people has been sentenced to seven years in prison, a court spokeswoman said on Friday.

David Ali Sonboly, 18, killed nine people in Munich in 2016 before shooting himself dead. Another 27 people were injured. Police concluded the German-born Sonboly was a lone gunman obsessed with mass killings and was not inspired by Islamist militancy.

The Munich public prosecutor’s office had charged the accused man with nine counts of negligent homicide, five counts of negligently causing grievous bodily harm and selling weapons illegally.

Public prosecutors had called for the man - identified only as Philipp K., as is customary under German law - to be sentenced to seven years and two months in prison. His lawyers had sought three and a half years.

Authorities arrested the man in Marburg, about 100 km (65 miles) north of Frankfurt in 2016, after contacting him on the so-called “dark net” and posing as buyers for an automatic weapon and a Glock 17 pistol for 8,000 euros ($9,806).

During a sting operation, the suspected arms dealer said he had sold the 18-year-old Iranian-German another Glock 17 pistol during a meeting in Marburg, followed by 350 rounds of ammunition during a second meeting.

A spokeswoman for the public prosecutor had said in August that evidence heard during the trial had shown that the suspect had far-right attitudes.