DETROIT - In a ruling sure to make philandering spouses squirm, Michigan's second-highest court says anyone involved in an extramarital fling can be prosecuted for first-degree criminal sexual conduct, a felony punishable by up to life in prison.

"We cannot help but question whether the Legislature actually intended the result we reach here today," Judge William Murphy wrote in November for a unanimous Court of Appeals panel, "but we are curtailed by the language of the statute from reaching any other conclusion."

"Technically," he added, "any time a person engages in sexual penetration in an adulterous relationship, he or she is guilty of CSC I," the most serious sexual-assault charge in Michigan.

No one expects prosecutors to declare open season on cheating spouses. The ruling is especially awkward for Attorney General Mike Cox, whose office triggered it by appealing a lower court's decision to drop CSC charges against a defendant. In November 2005, Cox confessed to an adulterous relationship.

Murphy's opinion received little notice when it was released, but it has since elicited reactions ranging from disbelief to mischievous giggling in Michigan's legal community.

The ruling grew out of a case in which a Charlevoix man accused of trading Oxycontin pills for the sexual favors of a cocktail waitress was charged under an obscure provision of Michigan's criminal law. The provision decrees that a person is guilty of first-degree criminal sexual conduct whenever "sexual penetration occurs under circumstances involving the commission of any other felony."

Charlevoix Circuit Judge Richard Pajtas sentenced Lloyd Waltonen to up to four years in prison after he pleaded guilty to two felony counts of delivering a controlled substance. But Pajtas threw out the sexual assault charge, citing the waitress' testimony that she had consented to the sex-for-drugs arrangement.

Prosecuting attorney John Jarema said he had decided to appeal after police discovered evidence that Waltonen may have struck drugs-for-sex deals with several other women.

Cox's office, which handled the appeal on the prosecutor's behalf, insisted that the waitress' consent was irrelevant. All that mattered, the attorney general argued in a brief, was that the pair had sex "under circumstances involving the commission of another felony" - the delivery of the Oxycontin pills.

The Attorney General's Office got a whole lot more than it bargained for. The Court of Appeals agreed that the prosecutor in Waltonen's case needed only to prove that the Oxycontin delivery and the consensual sex were related. But Murphy and his colleagues went further, ruling that a first-degree CSC charge could be justified when consensual sex occurred in conjunction with any felony, not just a drug sale.

The judges said they recognized their ruling could have sweeping consequences, "considering the voluminous number of felonious acts that can be found in the penal code." Among the many crimes Michigan recognizes as felonies, they noted pointedly, is adultery.

Waltonen has asked the state Supreme Court for leave to appeal the Court of Appeals ruling. He still hasn't been tried on the criminal sexual-conduct charge. His attorney said a CSC conviction could add dozens of years to Waltonen's sentence.