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 and state are separate," tweeted the renowned novelist Joyce Carol Oates. "The ugly word 'bastard' has been phased out of usage and next should come 'adultery' with its biblical rectitude and 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."
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, Breasseale said, but they are essential to the military, where officers and soldiers entrust their lives to one another.
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 such as 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 gentleman."
"We're asked to do the nation's hardest work," Breasseale said. As it conducts dangerous missions, he added, the military needs soldiers who follow orders and officers with uncompromised ethics.
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 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 General Petraeus and his leadership in placing importance on spirituality," Causey told Baptist Press last year. "General Petraeus focused on everyone's spirituality, not just Christianity."
Asked on Tuesday about Petraeus' own faith, Causey, who now serves with the Army Corps 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 nonreligious 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."