A Swedish court has acquitted a man who sexually assaulted a woman while he was asleep because he was unaware of what he was doing.

Mikael Halvarsson was charged earlier this year with rape after having sex with a woman sleeping beside him.



The 26-year-old was charged with rape and sentenced to two years in prison, but appealed the sentence teliing Sweden's Sundsvall Appeal Court he was completely asleep during the attack and had no intention of having sex.



In it's judgement, the court found Halvarsson "was in a state of sleepiness, unconcious of what was happening."



Halvarrson's ex girlfriend also told the court Halvarsson had previously attempted to have sex with her while asleep.



A doctor specialising in sleep disorders said Halvarsson could suffer from sexsomnia, a condition that allows a person to have sex while completely asleep and unaware.



The condition is highly controversial among psychiatrists and the legal profession, and has not been heavily researched, but was described by the doctor in court as being similar to sleepwalking.

Sexsomnia as a defence against rape has been accepted in a small number of cases.

In 2007, a 38-year-old man was acquitted of rape charges after claiming he was asleep and did not know what he was doing, and in 2011 when a second man was freed from similar charges, despite having a previous conviction.