The death of the girl, named only as Lena, shook the small town of Emden near Bremerhaven when her body was found in a car park in March.
The teenager admitted killing her, but denied sexually abusing her. He had also been accused of raping a woman jogger last November, but was not charged.
He was deemed not to have been fully culpable at the time, and the judge said he would spend at least ten years in a closed psychiatric clinic. He was also told to pay Lena’s family compensation nearly €85,000.
Lena’s death was so awful, and happened in such a tight-knit community, it triggered an enormous reaction. One teenager living in the area was wrongly identified as a suspect on the social network Facebook and had to leave town after receiving death threats.
Another teenager was arrested in May and kept in custody for two weeks, before being released.
DNA evidence led the police to the now convicted teenager, who was arrested a week after Lena’s body was found.