Brian Thomas, 59, of Neath in South Wales, killed his wife Christine, 57, while they were on holiday in July last year.
Prosecutors had accepted that Thomas had a sleep disorder and so had no control over his body when he attacked his wife of 40 years while they were both asleep.
“I must emphasise that the circumstances of this case are almost unique in the UK and there have been fewer than 50 instances recorded worldwide,” said Iwan Jenkins, Chief Crown Prosecutor for Dyfed Powys.
Thomas admitted being responsible but instead of charging him with murder or manslaughter, prosecutors had sought a special verdict of not guilty by reason of insanity, the Press Association reported.
“The consequences of such a finding would have meant Mr Thomas’s detention in a psychiatric hospital, but it is now clear that the psychiatrists feel that that would serve no useful purpose,” Jenkins said.
Swansea Crown Court heard Thomas regularly took anti-depressant drugs which made him impotent, and he had stopped doing so before the holiday as the couple, who slept in separate bedrooms at home, wanted to be “intimate”.
Medical experts said the sudden withdrawal of the drugs could have led to him having very vivid dreams.