Retired Gen. David H. Petraeus made the right decision in resigning from his post as head of the CIA after admitting he had been involved in an extramarital affair.

If for no other reason, Petraeus needed to step down because, as his former Army spokesman, Steve Boylan, said, "He screwed up, he knows he screwed up; now he's got to try to get past this with his family and heal."

Even under different circumstances, a military man who has spent most of the past decade in overseas theaters would do well to spend more time with his family. A job as demanding as the head of central intelligence would hardly allow for that.

After only 14 months at the CIA, Petraeus can be replaced, which is not the same as saying his leadership won't be missed. He is an exceptional commander, as demonstrated by his successful counterinsurgency campaign in Iraq and results-oriented tour of duty in Afghanistan. In time, he was expected to produce similar results in directing the CIA.

The public's perception of Petraeus didn't include cheating on his wife. The affair came to light when a Tampa woman who grew up in Philadelphia, Jill Kelly, complained to an FBI agent who is a friend that she had been receiving anonymous e-mails from someone accusing her of inappropriately flirting with Petraeus.

That began an FBI probe that tracked the e-mails to Paula Broadwell, 40, an Army Reserve officer, who cowrote the biography All in: The Education of General David Petraeus with Vernon Loeb, a Washington Post editor who prior to that was an Inquirer editor.

After obtaining access to Broadwell's account, FBI agents discovered sexually explicit e-mails sent to her from an unidentified account that was eventually traced to Petraeus. It was concluded that he and Broadwell, whom he first met in 2006, had been involved in an affair. Broadwell confirmed the relationship in an Oct. 21 interview with the FBI.

The director of national intelligence, James Clapper, reportedly wasn't informed until the evening of the presidential election. He then called Petraeus, who had been interviewed by the FBI, and urged him to resign. Petraeus submitted his resignation to President Obama Thursday, and he accepted it the next day.

Understandably, many believe Petraeus' moral lapse isn't sufficient to require his dismissal. Some note that Allen Dulles' being a known adulterer didn't keep him from leading the CIA from 1953 to 1961. A key difference, though, is that Dulles' behavior wasn't a secret; he even noted his conquests in letters to his wife.

In contrast, Petraeus and Broadwell's covert tryst risked putting themselves in a position to be blackmailed. In fact, the FBI found some classified information in going through Broadwell's e-mails, though none could be traced to Petraeus.

Petraeus resigned because he believed it was the right thing to do. For years, this country has looked at him as the very model of honor and valor that exemplifies its military command. He refused to carry on as if it meant nothing to violate the code of conduct of the Army he so loves.