The man who illegally sold a pistol to an 18-year-old who carried out a mass shooting in Munich in 2016 was sentenced to seven years and two months in prison on Friday.

Watch video 04:17 Share How Germany handles guns Send Facebook google+ Whatsapp Tumblr linkedin stumble Digg reddit Newsvine Permalink https://p.dw.com/p/2npo9 How Germany handles guns

A Munich court found the 33-year-old man, identified as Philipp K. in line with Germany's privacy laws, guilty of nine counts of involuntary manslaughter, five counts of involuntary bodily harm, and violating weapons laws.

Philipp K. sold a gun and ammunition to Iranian-German David S., who went on to kill nine people and then himself in July 2016. Another 27 people were injured in the rampage.

Read more: In Munich, recovery after shooting comes with frustration

"I would like to express my condolences to the relatives and the survivors — I never wanted that, I am sorry," Philipp K. said in a closing statement that presiding Judge Frank Zimmer read out in court.

It was the first time that an illegal weapons dealer in Germany was found to be partly responsible for an act that he did not take part in, reported Germany-based news agency dpa.

Read more: Darknet, the shady internet

Nine people were killed in the rampage at Munich's Olympia mall

Gun purchased on darknet

The teen shooter purchased the Glock 17 pistol and 450 rounds of ammunition from Philipp K. via the darknet and picked up the weapon in the central German town of Marburg, where the defendant lived.

David S., a Nazi sympathizer who suffered from mental illness, then used the weapon to open fire at Munich's Olympia shopping mall before later shooting himself.

Philipp K. admitted to selling the weapon to David S. but said he wouldn't have agreed to the sale if he'd known about the teen shooter's plans or his mental health issues. Authorities arrested the suspected arms dealer in August after contacting him on the darknet and posing as buyers of an automatic weapon and a Glock 17 pistol.

Read more: Selling on the darknet? Germany's BKA is buying (undercover)

Prosecutors argued that Philipp K. should have known that people were likely to get hurt based on the circumstances of the sale. During the trial, the court also heard evidence that showed the defendant had far-right leanings, similar to those of the shooter.

Police and prosecutors believe that the violent crime was triggered by bullying that David S. experienced in school. A report commissioned by the city of Munich, however, says the shooter had right-wing extremist motivations. The majority of the shooting victims were young people of color.

Watch video 00:42 Merkel attends Munich memorial (31.07.2016)

rs/sms (AP, AFP, dpa)