He stabbed the 59-year-old to death with a knife in her front garden after months of harassment, including loitering outside her home, scratching her car and making threatening phone calls.
The killer’s defence asked for the man to be convicted of manslaughter but the presiding judge told the court: “The accused is entirely responsible for his actions.”
The two first met at a dance class and later began an intimate relationship.
But after the woman broke off the association, he continued to pester her until a court ruled that he could not attend any dance classes where she was present.
"What may once have been love and then friendship had disappeared and turned to fury," the judge said on Thursday.
After killing the woman the man tried to drown himself in the River Neckar which runs through Heidelberg. He was rescued by a jogger after losing consciousness.
Addressing the court, he said tearfully: "I wanted the opposite of this indescribable disaster."