It's tempting to view the sex scandal surrounding retired Army Gen. David Petraeus through a religious lens.
After all, most faiths forbid adultery, and even before his fall from grace, some Pentagon colleagues compared Petraeus to the biblical King David—another proud and powerful warrior.
The comparison seemed even more apt after the former four-star general's resignation from the CIA on Friday. "More than one officer cited the biblical adultery of King David and Bathsheba," wrote The New York Times.
The Bible says that David acted righteously and kept God's commandments—except in the case of Uriah the Hittite, Bathsheba's husband.
"Will history remember David Petraeus with the same caveat?" asked Jim Denison, a Southern Baptist scholar in Dallas.
Even liberals saw the scandal in religious terms, albeit from an opposite pole.
"Don't understand why `adultery' is quasi-illegal in a nation in which church & state are separate," tweeted the renowned novelist Joyce Carol Oates. "The ugly word `bastard' has been phased out of usage & next should come `adultery' with its Biblical rectitude & cruelty."
But the military's anti-adultery rules are not based on religion, biblical or otherwise, said Lt. Col. Todd Breasseale, a Pentagon spokesman.
"To be clear, it has nothing to do with a religious version of what morality is and everything to do with maintaining good order and discipline," he said.
Article 134 of the Uniform Code of Military Justice criminalizes adultery when three elements are met: two people had sex, one of them was married, and their conduct compromised military discipline and order or brought "discredit upon the armed forces."
The rules may seem archaic to modern Americans, but they are essential to the military, where officers and soldiers entrust their lives to one another other, Breasseale said.
Imagine if a senior officer was having an affair with an enlisted soldier's spouse. "His decision-making would rightly be second-guessed," Breasseale said, "and that would cause a ripple-effect through the unit."
Bible readers may remember that King David ordered his troops to abandon Uriah on the battlefield so that the cuckolded husband would be killed, surely a worst-case scenario.
As in civilian America, extramarital affairs are fairly common in the military, experts said, as soldiers spend long tours of duty stationed far from home. Adultery tends to be prosecuted only when the conduct is egregious, when it accompanies other crimes like sexual misconduct, or when a high-ranking officer is involved.
"It's hard to make the case when I'm representing a senior military officer on adultery that the good order and discipline of the unit was not affected," said Victor M. Hansen, a professor at New England Law in Boston. For 15 years, Hansen served as an Army Judge Advocate General and later represented accused officers in military courts as a defense attorney.
What's more, the military prides itself on maintaining high moral standards. Soldiers can still be prosecuted for "conduct unbecoming an officer and a gentlemen," after all.
"We're asked to do the nation's hardest work," Breasseale said. As it conducts dangerous missions, the military needs soldiers who follow orders and officers with uncompromised ethics, he said.
There's little chance Petraeus, the most heralded officer of his generation, will face adultery charges, said military law experts. For one thing, the ex-general retired from the Army to take the CIA post. A former Petraeus spokesman says the affair began after the general had left the Army.