Updated

A California appeals court has overturned the rape conviction of a man who pretended to be a sleeping woman's boyfriend, saying in part that an arcane law from 1872 doesn't protect unmarried women in such cases.

In a decision posted Wednesday from the Los Angeles-based court, a panel of judges reversed the trial court's conviction of Julio Morales and remanded it for retrial.

Judge Thomas L. Willhite Jr. writes the law contains "historical anomalies" and the case should be retried to ensure the jury's conviction is supported.

Morales had been sentenced to three years in state prison after entering a woman's bedroom late one night after her boyfriend had gone home and initiating sexual intercourse while she was asleep, after a night of drinking.

The decision urges the Legislature to examine the law.