Graham Coutts said Jane Longhurst's death was an accident
A musician accused of strangling a teacher told doctors he had been having "murderous thoughts" about women since he was 15, a court heard.
Graham Coutts was seen by psychiatrists in 1991, 12 years before he was alleged to have murdered Jane Longhurst, the jury at an Old Bailey retrial was told.
He told them he feared his thoughts may lead to criminal behaviour.
Mr Coutts, 39, from Hove, East Sussex, denies murdering Miss Longhurst, 31, originally from Reading, Berkshire.
Referred by GP
The prosecution alleges he was having non-consensual sex with her when he killed her to satisfy a "perverted sexual interest".
He claims her death was an accident.
Consultant psychiatrist Dr Larry Culliford said on Friday he had seen Mr Coutts in December 1991 after he had been referred by his GP.
Dr Culliford said the patient had complained of having enjoyable, murderous thoughts about women during sexual arousal.
Reading from his notes, he said: "Accepts he has a problem and now says these are unwanted thoughts... that they are pre-occupying him to the detriment of his life and may also lead on to criminal behaviour."
Jane Longhurst was a special needs teacher and musician in Brighton
The doctor concluded that Coutts required more detailed assessment and referred him to forensic psychiatrists.
The prosecution has told jurors Mr Coutts kept Ms Longhurst's body for about 11 days after she died in 2003, "possibly somewhere in the same house where he was living with his then-partner".
He was said to have moved the body to a storage unit in Brighton, hired in a false name, and kept it there for almost a month, visiting "regularly every few days".
Ms Longhurst's body was found after he moved it to secluded woods - Wiggonholt Common near Pulborough - and set fire to it, the jury heard.
The trial continues.