(RNS) 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 each 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.
Still, the scourge of public censure must sting the pride of a man who cultivated a stainless public persona. "He'd always preached to his proteges that character was what you did when no one was watching," wrote Vernon Loeb of The Washington Post.
Petraeus also preached about the significance of spirituality, according to Army Chaplain Col. Brent Causey, who spent 13 months with the general in Afghanistan. At least four in 10 service-members stationed there attended chapel, Causey said.
"It was a reflection of Gen. Petraeus and his leadership in placing importance on spirituality," Causey told Baptist Press last year. "Gen. Petraeus focused on everyone's spirituality, not just Christianity."
Asked on Tuesday about Petraeus' own faith, Causey, who now serves with the Army Corp of Engineers in Washington, said, "Sorry, I'm not allowed to talk about that," and quickly hung up.
Breasseale, who worked with Petraeus, said he never heard the general express particular religious or political preferences.
Petraeus has never been beloved by anti-war liberals, though, especially those who see evangelical Christianity creeping over the military's church-state wall.
The Military Religious Freedom Foundation chided the general for endorsing "Under Orders: A Spiritual Handbook for Military Personnel," a book by former military chaplain William McCoy that the foundation says promotes Christianity and denigrates non-religious soldiers.
If Petraeus still harbors political aspirations, now might a good time for him to get religion and read that book, said the New Yorker's Jon Lee Anderson. "If he licks his wounds and is seen praying humbly at his local church and does the right thing by his wife and family, America will probably forgive him," Anderson wrote.
For what it's worth, it seems like evangelical broadcaster Pat Robertson already has.
"The man's off in a foreign land, he's lonely and here's a good-looking lady throwing herself at him," Robertson said during a recent broadcast of the "The 700 Club."
"I mean, he's a man."