A state appeals court has overturned the rape conviction of a man who had sex with a sleeping woman who said she mistook him for her boyfriend, but then tried to end the encounter when she realized the man was a stranger.

The Los Angeles-based court, which said it made the ruling reluctantly, wrote that a state rape law dealing with sex by impersonation applies only to victims who are married.

“A man enters the dark bedroom of an unmarried woman after seeing her boyfriend leave late at night, and has sexual intercourse with the woman while pretending to be the boyfriend,” the three-judge panel of the 2nd District Court of Appeal wrote. “Has the man committed rape? Because of historical anomalies in the law and the statutory definition of rape, the answer is no, even though, if the woman had been married and the man had impersonated her husband, the answer would be yes."

The justices noted that prosecutors advanced two legal theories — that the defendant raped by tricking the victim, which applies only to married women, and that sex with a sleeping person is defined as rape under law.

Because it was unclear under which theory the jury convicted the man, the court overturned the conviction, sending it back to the trial court. An earlier trial had ended in a hung jury.

If the case is retried, prosecutors should base their case on the sleeping victim law, the court advised.

ALSO:

Superman caught on video flying along Carlsbad beach

First of two L.A. pot shop initiatives qualifies for May ballot

-- Maura Dolan