The incident took place in June last summer in the village of Vilhelmina after the woman had passed out in a cabin following a night of heavy drinking.
The 27-year-old then began having sexual intercourse with the sleeping woman, according to the indictment, which was filed on Thursday in the Lycksele District Court.
As the woman was judged to be in a helpless state at the time of the incident, prosecutors have charged the man with rape.
But the man told investigators he was innocent as he too was asleep at the time of the alleged rape.
“I was awakened by her pushing me away and asking, ‘Are you awake?’,” the man said under questioning, according to the Aftonbladet newspaper.
The 27-year-old explained that he suffers from somnambulism and sexsomnia, an affliction whereby sufferers perform sexual acts while still asleep.
According to the man, the incident wasn’t the first time he had woken up to find he’d had sex without knowing it.
He said that it happened on occasion that his former girlfriend would tell him when he woke up in the morning that he had had intercourse with her in his sleep.
While sexsomnia is rare, it is an accepted medical condition.
“This is very well-accepted as a diagnosis within the field of sleep medicine,” neurologist Cramer Bornemann of the Minnesota Regional Sleep Disorders Center in Minneapolis told medical advice website WebbMD.
“It’s different than having a sexual dream. It’s full-fledged sexual behavior while asleep.”
According to Aftonbladet, an expert on sleep disorders is scheduled to testify at the 27-year-old’s trial.
In 2007, the sex-while-sleeping defence led to the acquittal of a 38-year-old man accused of molesting an 8-year-old girl.
And in 2011, a man was acquitted on appeal after initially being convicted of raping a sleeping woman while in his sleep.