What if you rape someone while you’re asleep? Well, according to the Swedish courts, you’re not to blame. Mikael Halvarsson of Sundsvall, Sweden, was recently acquitted of rape charges after doctors confirmed he did, in fact, suffer from the rare condition of sexomnia and had committed the crime unintentionally while asleep. Surprisingly enough, Halvarsson isn’t the first man to be cleared of rape charges because of this rare condition.

On April 2, 2014 Halvarsson and a female friend shared a bed together, but according to ABC News, “each had their own blanket.” Later that night the victim awoke to find Halvarsson sexually assaulting her, and quickly called the police. Officers arrived to find Halvarsson still asleep in the victim's bed. In his defense, Halvarsson claimed that he had not meant to harm the woman and suffered from a rare, although not unheard of, condition called sexomnia.

Sexomnia is a type of parasomnia, a condition where an individual completes activities in his sleep without being aware of it. During a bout of sexomnia, the individual may masturbate or initiate intercourse with the person sleeping next to him, whether willing or not. Fox News reported that the condition is believed to only affect about one percent of the world’s population, with most individuals reporting spurts of the condition during times of high stress and fatigue. The condition is well documented and found in both men and women.

Halvarsson isn’t the first man to blame his rape charges on the condition, so how does one set apart those suffering from parasomnia from a common criminal? Dr. Kingman Strohl, a professor of medicine and director of research at the Sleep Center at Case Medical Center in Cleveland told ABC News that contrary to common belief, the condition is actually quite difficult to fake.

“Usually people are very scared and also quite confused as to what's going on,” he said, adding that doctors look for signs in the patient's medical history, and that it has “gone on before and occurs in context of sleep walking and sleep talking." In Halvarsson’s case, both his ex-girlfriend and his mother testified that the man did indeed have a history of abnormal sleeping behavior, which included sexual activity.

Other signs include the “skillfulness” that the individual will apply to activities done while asleep. In the case of parasomnia, such as sleepwalking and sexomnia, the person isn’t dreaming but rather dong an automatic action. This could include everything from walking around the house to, of course, initiating intercourse.

They aren’t able to complete complex tasks, so when telling fakers apart from those with the condition, it’s important to take note of the individual’s composure during the crime. For example, sexomniacs are described as being “glassy-eyed” during sexual activity, just as a sleepwalker would appear unresponsive when meandering around the house.

"You want to know how people react to it. You want to know what the people look like and want to know how each partner reacts to it," said Strohl of diagnosing a sexomnia incident.

Thankfully, the condition is treatable. Treatment includes a combination of medication, CPAP for obstructive sleep apnea, and even anticonvulsant therapy.