Center for Strategic Communication

David Petraeus being sworn in as CIA chief, with his wife Holly looking on. Photo: CIA

Updated 10:23 pm. David Petraeus, the director of the Central Intelligence Agency, has resigned.

Petraeus told CIA employees Friday in a letter that he was stepping down “for personal reasons… After being married for over 37 years, I showed extremely poor judgment by engaging in an extramarital affair. Such behavior is unacceptable, both as a husband and as the leader of an organization such as ours.”

Former aides to Petraeus, the retired four-star general who led the U.S. military campaigns in Iraq and Afghanistan, said they “never in a million years” would’ve believed that Petraeus would risk his storied career in such a fashion. But he did. CIA representatives confirmed the authenticity of the letter to Danger Room. “He feels that he screwed up.  He did a dishonorable thing and needed to try to do the honorable thing,” e-mails one former confidant.

According to Slate and the Associated Press, Petraeus’ partner in the affair was his biographer and confidant Paula Broadwell, who travelled with Petraeus extensively while he was the top commander in Afghanistan. The former aide, however, insists that the affair began after Petraeus retired from the military — and while he was director of the CIA.

Whenever the affair began, America’s most famous general in a generation and its leading spy is now leaving Washington in disgrace.

Petraeus’ CIA tenure first appeared to be in jeopardy last week, when the Wall Street Journal published an article alleging that Petraeus has been, in effect, asleep at the switch during the attack on the U.S. mission in Benghazi, Libya.

But Petraeus’ former aide insists that wasn’t the reason for his departure. “This had nothing to do with Benghazi or relationship with the White House — which by the way was excellent — or anything else for that matter,” the aide tells Danger Room. “Just his flawed behavior.”

It is difficult to overstate the impact Petraeus had on the U.S. Army. Obviously, there’s his stewardship of the surge in Iraq, which sold the military on counterinsurgency, which it would apply to much less success in Afghanistan. But Petraeus’ influence took subtler, and possibly longer-lasting, forms.

Before he took command of the Iraq war in 2007, Petraeus ran the Combined Arms Center at Fort Leavenworth, a haven for Army big think. There, Petraeus tutored a lot of majors and lieutenant colonels back from Iraq and Afghanistan as they came to grips with how they could have applied their military training so assiduously but without notable effect on the wars. With counterinsurgency, Petraeus gave them, and the many others he mentored, a template for viewing both their experiences and military operations going forward. The Army’s next generation of generals will carry that as a formative experience.

Doug Ollivant, a retired Army officer who worked closely with Petraeus as the National Security Council’s director for Iraq policy under both the Bush and Obama administrations, says Petraeus’ legacy within the Army was “fixed” when Petraeus shed his uniform to helm the CIA.

“I’m kind of appalled to live in a country where you have to resign over an affair that has little to no effect on your job, although I recognize the blackmail implications,” Ollivant tells Danger Room, cautioning that if Petraeus was “sleeping with someone the director of the Agency shouldn’t be, then that’s something different.”

Just this week, Broadwell solicited from Petraeus five “Rules for Living” for Newsweek. His first lesson: “Lead by example.” His fifth: “We all will make mistakes. The key is to recognize them and admit them, to learn from them, and to take off the rear­ view mirrors—drive on and avoid making them again.”

Anonymous law enforcement officials tell NBC News that Broadwell is “under FBI investigation for improperly trying to access his email and possibly gaining access to classified information.” Other officials are telling the Associated Press that an FBI investigation led to the discovery of Petraeus’ affair.

In a statement released Friday afternoon, the President accepted Petraeus’ resignation, and offered his “thoughts and prayers [to] Dave and Holly Petraeus, who has done so much to help military families through her own work. I wish them the very best at this difficult time.”

Sen. Diane Feinstein, the chairwoman of the Senate intelligence committee, added in a separate statement, ”I wish President Obama had not accepted this resignation, but I understand and respect the decision.”

Petraeus met his future wife, Hollister “Holly” Knowlton, in 1973. She was the “beautiful, smart and witty” daughter of West Point’s superintendent, visiting for a weekend football game. He was a young cadet, drafted into a blind date with her, according to All In: The Education of General David Petraeus, Broadwell’s deeply detailed biography.

Soon, the two would find themselves commuting to each other’s colleges whenever time allowed, sometimes braving fierce New York snowstorms to spend time together. Petraeus would sneak in the side door of the superintendent’s home aside the Plain, the academy’s parade field, to visit Holly when she made the trip back to West Point…

David’s roots stood in sharp contrast to his bride’s patrician-military upbringing. To Petraeus, the stature of Holly’s family was intoxicating. He loved becoming a part of it. Holly’s well-connected and accomplished grandparents has a large compound in West Springfield, New Hampshire, with a boathouse on a nearby lake that they would visit often. Holly’s father, Lieutenant General Knowlton, came from a prominent and well-to-do Massachusetts family and had graduated seventh in his class at West Point…

He would become Petraeus’s “military father,” according to General Knowlton’s wife, Peggy. Petraeus would be their “fourth son.”

When Petraeus took over command of the Afghan war effort in 2010, he made an appearance before Congress. In his opening statement, he said: “My wife, Holly, is here with me today. She is a symbol of the strength and dedication of families around the globe who wait at home for their loved ones while they’re engaged in critical work in Afghanistan, Iraq and elsewhere. She has hung tough while I have been deployed for over 5 1/2 years since 9/11.”

On the heels of the Petraeus resignation came another unexpected announcement with suddenly familiar overtones: defense giant Lockheed Martin fired its interim CEO, Chris Kubasik, for a “close personal relationship” with a subordinate.