In most of those states, including New York, adultery is a misdemeanor. But in others — Massachusetts, Idaho, Michigan, Oklahoma, and Wisconsin — it is a felony, though rarely prosecuted. In the armed forces, it can be punished severely, although usually in combination with greater wrongdoing.

NEW YORK — When David H. Petraeus resigned as CIA director because of adultery, he was widely understood to be acknowledging a misdeed but not a crime. Yet in his state of residence, Virginia, as in 22 others including Massachusetts, adultery remains a criminal act, a vestige of the way US law has anchored legitimate sexual activity within marriage.


In nearly all the rest of the industrialized world, adultery is not covered by criminal code.

Like other US state laws related to sex — sodomy, fornication, rape — adultery laws date to the Old Testament, onetime capital offenses stemming at least partly from a concern about male property. Peter Nicolas of the University of Washington Law School said the term stemmed from the notion of ''adulterating'' or polluting the bloodline of a family when a married woman had sex with someone other than her husband and ran the risk of having another man's child.

Linda C. McClain, who teaches family law at Boston University, likes to give her students two decisions from New Jersey courts, the first from 1838 and the second from 1992, to demonstrate how things have changed.

In the 1838 decision, the court said that the harm of adultery lay not in ''the alienation of the wife's affections, and loss of comfort in her company,'' but in ''its tendency to adulterate the issue of an innocent husband, and to turn the inheritance away from his own blood, to that of a stranger.''

In the 1992 civil case, the court said that ''adultery exists when one spouse rejects the other by entering into a personal intimate sexual relationship with any other person.''


Most states have purged their codes of laws regulating cohabitation, homosexual sodomy, and fornication — sex between unmarried adults — especially after the 2003 Supreme Court decision in Lawrence v. Texas that made sexual activity by consenting adults in private legal across the country. But the question of how that ruling affects adultery remains unanswered because others may be harmed by adultery — a spouse and children. Several courts have alluded to the constitutionality of adultery laws since the Lawrence decision.

But Melissa Murray, a University of California Berkeley law professor, said she thought ''most courts in light of Lawrence are going to give adultery a wide berth.'' She added: ''It is an open question whether adultery continues to be viable as criminal law even though it remains on the books."

Some law professors, including Joanna L. Grossman of Hofstra University, said one reason that adultery laws remain on the books is that getting rid of them would require politicians to declare their opposition to them, which few would do. In addition, many like the idea of the criminal code serving as a kind of moral guide even if certain laws are almost never applied.

Petraeus is a retired four-star general who gets a military pension and remains subject to military codes of conduct that prohibit adultery. But Diane H. Mazur, a professor of law at the University of Florida and a former Air Force officer, said that the chances of the Army calling Petraeus back to active service in order to court-martial him in an adultery case are zero, as are any chances of state criminal charges being brought.


Even within the military code, she added, adultery is charged as a criminal offense only when ''the conduct of the accused was to the prejudice of good order and discipline in the armed forces,'' she read from the manual for courts-martial. That meant something larger than seemed at stake here.