COPENHAGEN, Denmark -- A Danish man has been acquitted of molesting two 17-year-old girls after he was found to suffer from a rare sleep disorder known as "sexsomnia."

The Glostrup court said Wednesday that the man fondled the teenagers while sleeping in his suburban Copenhagen apartment after a party in 2011.

The girls awoke and interrupted the man, and later reported him to police.

But the court cleared the 31-year-old of sex crimes charges, saying medical tests show he suffers from "sexsomnia" in which a person engages in sexual activity while asleep.

Michael Laub, a Danish sleep specialist who wasn't involved in the case, said it's a rare but widely recognized sleep disorder.

The defendant said he had no recollection of what happened.

Prosecutor Martin von Buelow said he wouldn't appeal the ruling.

Also on HuffPost:

Loading Slideshow...
  • In this Wednesday, April 3, 2013 photo, an Indian boy jumps into the Ganges River in Allahabad, India. Allahabad, on the confluence of the Ganges, Yamuna and the mythical Saraswathi River, is one of Hinduism's holiest sites. (AP Photo/Rajesh Kumar Singh)

  • A Saudi man smokes his last cigarette before being hanged for the murder of a compatriot just west of the capital Kuwait City, on April 1, 2013. (YASSER AL-ZAYYAT/AFP/Getty Images)

  • In this Wednesday, March 27, 2013 photo, Egyptians celebrate mass, reading the Arabic service on a computer screen, in the Coptic Orthodox Church in Samalout, in the province of Minya, Egypt. (AP Photo/Thomas Hartwell)

  • Snow-covered beach chairs stand at the lido of Strandbad Wannsee in Berlin, Germany, Good Friday March 29, 2013. Bathing season at the lido traditionally starts on Good Friday. (AP Photo/dpa, Rainer Jensen)

  • View of Barra Beach on April 04, 2013 in Rio de Janeiro, Brazil. (Buda Mendes/LatinContent/Getty Images)

  • Palestinian youths practice their parkour skills in KhanYounis, southern Gaza Strip , Sunday, March 31, 2013. Parkour is a physical discipline of movement focused on overcoming obstacles. (AP Photo/Hatem Moussa)

  • Pope Francis lies down in prayer during the Passion of Christ Mass inside St. Peter's Basilica, at the Vatican, Friday, March 29, 2013. (AP Photo/Gregorio Borgia)

  • A leopard (Panthera pardus) looks up from within a well in a residential area of Guwahati on April 4, 2013, before it was tranquilsed and taken to Guwahati Zoo. (BIJU BORO/AFP/Getty Images)

  • A woman dressed in traditional clothes dance with a tourist as part of the Holy Week celebrations in Ayacucho, Peru, Saturday, March 30, 2013. (AP Photo/Rodrigo Abd)

  • A boy is carried in a polystyrene box as thousands of city slum dwellers take an Easter Sunday dip on the polluted Manila Bay to beat the scorching heat on March 31, 2013. (NOEL CELIS/AFP/Getty Images)