'Arcane' 1872 California law cited in overturning rape conviction California appeals court orders a retrial in a 2009 rape case Court cites 'historical anomalies' in an 1872 law and definition of rape The attorney general will seek to change 'arcane' law A man allegedly pretended to be an 18-year-old woman's boyfriend in a dark bedroom (CNN) -- California's top prosecutor will seek a change in an 1872 state law after an appeal courts cited "historical anomalies in the law" when overturning a rape conviction of a man who allegedly pretended to be an 18-year-old woman's boyfriend in a dark bedroom. The appeals court ordered a retrial in the 2009 rape case. "This law is arcane and I will work with the Legislature to fix it," Attorney General Kamala D. Harris said in a statement Friday. The evidence is clear that this case involved a nonconsensual assault that fits within the general understanding of what constitute rape. This week, the California Court of Appeal overturned the rape conviction of Julio Morales, who was accused of raping an 18-year-old acquaintance after her boyfriend left the bedroom and she fell asleep. The court laid out the unusual circumstances of the case and problems in the 1872 law in the first paragraph of its ruling Wednesday: "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 court 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 court said. Los Angeles County prosecutors charged Morales with rape of an unconscious woman under the 1872 law, the court said. He was eventually convicted and sentenced to three years. During the trial, the jury was instructed that "[a] woman is unconscious of the nature of the act if she is unconscious or asleep or not aware that the act is occurring or not aware of the essential characteristics of the act because the perpetrator tricked, lied to, or concealed information from her." The prosecutor argued correctly that the 18-year-old woman was asleep, but argued incorrectly that the woman wasn't aware of the act because Morales deceived her in believing he was her boyfriend, the court said. In conflicting testimony, the defendant testified at one point that he told the woman he wasn't her boyfriend, the court said. "Because we cannot discern from this record whether the jury convicted defendant on the correct or incorrect theory, we must reverse," the court said. "We conclude that under the peculiar facts of this case, reversal is required because the prosecutor argued an incorrect theory of guilt, the instruction permitted the jury to convict on that theory, and the record does not permit us to find that the jury relied only on the prosecutor's correct theory," the court said. Morales' court-appointed attorney, Edward H. Schulman of Northridge, California, said the appeals court said the retrial must omit the controversial instruction about an unconscious rape victim not being aware of "the essential characteristics of the act because the perpetrator tricked, lied to, or concealed information from her." The retrial would be Morales' third trial, Schulman told CNN. The first trial resulted in a hung jury, and the second convicted Morales, he said. Morales is now his early 20s, the attorney said. CNN's Stefan Simons contributed to this report.