The patient had been granted temporary leave and was to spend the night with his 25-year-old ex-girlfriend in Järfälla, north-west of Stockholm, earlier this year, reports broadcaster SVT.
She had broken up with the man, who has a long history of depression and anxiety. He had told the psychiatric ward that he was suicidal and that he had also had thoughts about harming or killing her.
Police found the woman dead with several stab wounds in the apartment in Järfälla in the early hours of May 3rd after the man himself called emergency services and confessed the crime.
He has now been sentenced to 18 years in jail for killing the woman, reports SVT.
Attunda District Court also ordered him to pay damages to the woman's family.