Attunda District Court on Friday found Kristoffer Andersson guilty of murder and disturbing the peace of the dead, but freed him from a charge of attempt at aggravated rape.
It sentenced him to psychiatric care in a closed mental health facility for offenders.
He had previously admitted to strangling Ida Johansson, who was found dead in the early hours of August 6th in the Runby area of the Stockholm suburb of Upplands Väsby. However, he had denied murder.
The court referred to a psychiatric report by Sweden's National Board of Health and Welfare (Socialstyrelsen), which had found that he was suffering from mental illness at the time of the murder, including recurrent psychosis-like episodes as well as an impulse control disorder.
He had told police that he met Johansson after going out for a walk to clear his head after an argument. When asked in interrogations what his first thought was when he saw her, he replied: "Kill."
Andersson, who was not known to police previously, was caught by police after a witness placed him at the scene on the night of the crime. A DNA test confirmed that he had been in the area at the time of Johansson's death.
Flowers left at the running tracks in Runby. Photo: Vilhelm Stokstad/TT
The high-profile search for Johansson's killer was extensive, seeing police comparing the DNA of over 800 men with traces found at the crime scene.
The murder stirred debates in Sweden about female safety while out running. Just days after she was found dead, thousands of people took to tracks across the Nordic country in the much-publicized 'Run with love' campaign to pay tribute and to show defiance in the face of fear.