The FBI investigation that uncovered the extramarital affair leading to the resignation of CIA Director David Petraeus began after a woman complained to law enforcement officials about harassing emails.
The Federal Bureau of Investigation traced the emails to Paula Broadwell, the author of a Petraeus biography identified as having the affair with him, according to two officials briefed on the probe.
They say her messages warned another woman to stay away from General Petraeus.
Major-General David Petraeus on active duty in Iraq in 2004. Photo: Reuters
In their probe, investigators stumbled across extensive online correspondence between Broadwell and Petraeus, most and perhaps all of it using their respective gmail accounts.
Within weeks, one of the most decorated retired generals in the US and chief of the leading spy agency was submitting his resignation to a re-elected President Barack Obama.
"After being married for over 37 years, I showed extremely poor judgment by engaging in an extramarital affair," Petraeus, 60, wrote yesterday to Central Intelligence Agency employees.
Paula Broadwell with her book on David Petraeus. Photo: Ortega Gaines
"Such behavior is unacceptable, both as a husband and as the leader of an organization such as ours."
Despite the national security concerns raised by the disclosure, one official said, General Petraeus's downfall reads more like a soap opera than a spy novel.
Concerned after discovering correspondence because of an earlier Chinese hack into the Google email service, which the McAfee internet security company dubbed "Operation Aurora," the FBI was investigating whether General Petraeus's private or CIA email accounts had been compromised, the official said.
They so far have found no evidence of a security breach, any loss of classified material or any evidence that another foreign power was aware of General Petraeus's infidelity, which the official said could have exposed him to blackmail.
Three people, all intelligence, military or congressional officials, have identified Ms Broadwell, who wrote All In: The Education of David Petraeus, as the woman who had an affair with General Petraeus.
While the investigators interviewed General Petraeus for the first time in late October, the official said, the FBI didn't tell Petraeus's nominal superior, Director of National Intelligence James Clapper, of its findings until late afternoon of election day, November 6, a second US official said.
Mr Clapper, this official said, recognised immediately that General Petraeus could not remain at the CIA and informed National Security Adviser Tom Donilon of the matter on November 7.
The first official said there appeared to be no criminal or national security matters involved, adding that it was not clear if the FBI has closed its investigation.
The discovery of the affair, and ultimately the resignation of General Petraeus, marks the derailment of the career of the man widely commended for his oversight of the US wars in Iraq and Afghanistan.
Often mentioned as a future presidential candidate, General Petraeus disclosed the affair and the surrounding investigation in a meeting with the president on November 8, according to a source. He offered his resignation, which Mr Obama accepted yesterday.
"By any measure, he was one of the outstanding general officers of his generation, helping our military adapt to new challenges," Mr Obama said in a statement yesterday.
In Iraq and Afghanistan, the president said, General Petraeus "helped our nation put those wars on a path to a responsible end".
CIA Deputy Director Michael Morell took over as acting director with General Petraeus's departure, Mr Obama said. The president said he was "completely confident that the CIA will continue to thrive and carry out its essential mission."
One official said that although the investigators were surprised to discover email evidence that General Petraeus was having an affair, they did not report that to the House and Senate intelligence committees, despite the fact that such a relationship could have exposed national security secrets.
Michael Kortan, an FBI spokesman, declined to comment.
The sensitivity of an extramarital affair at the CIA stems from the potential for exposure to blackmail, according to one US official, as well as the issue of a leader setting a bad example for subordinates.
In General Petraeus's case, however, the affair did not jeopardise his high-level security clearances, because he had already passed the polygraph exam required for a Top Secret clearance as a senior military officer and didn't need to retake it at the CIA, the official said.
Ms Broadwell's book examining his career and leadership style began as her PhD dissertation. In 2010, she "was embedded with the general, his headquarters staff and his soldiers on the front lines of fighting across Afghanistan," according to her website, www.paulabroadwell.com.
In her book's preface and during a January 25 appearance on Comedy Central's The Daily Show, Ms Broadwell said she had interviewed General Petraeus while the two went running.
"I thought I'd test him, but he was going to test me," Ms Broadwell told host Jon Stewart. "It ended up being a test for both of us."
The sudden departure of General Petraeus leaves another national security vacancy for Mr Obama to fill, with Secretary of State Hillary Clinton and Defense Secretary Leon Panetta expected to leave some time next year, possibly along with Mr Clapper.
Mr Morell, who is close to Deputy National Security Adviser Denis McDonough and other National Security Council staff, is a leading candidate to succeed General Petraeus, along with Michael Vickers, undersecretary of defense for intelligence, according to administration officials who spoke on the condition of anonymity.
Another potential candidate, former Nebraska Republican Senator Chuck Hagel, a co-chairman of the President's Intelligence Advisory Board, has shown no interest in the job.
Commending General Petraeus for his "drive and focus" at the agency, Mr Morell said in a statement to CIA employees that "our top priority now is what it always has been – to stay focused on mission and on all the important work we do."
General Petraeus received mixed reviews from intelligence officers he commanded. While some admired his intellect and political savvy, others regarded him as too enamored of drone strikes and other military operations, excessively self-assured and not sufficiently interested in continuing to rebuild the CIA's less glamorous human intelligence capabilities, officials said.
A graduate of the US Military Academy at West Point, General Petraeus retired from the Army in 2011 to take the helm of the CIA. Before that, he was the top US commander in Afghanistan.
General Petraeus, a specialist in counter-insurgency tactics, became well known in Washington circles during his time overseeing and implementing President George W. Bush's 2007 "surge" of US troops in Iraq. In regular appearances on Capitol Hill, some involving members of Congress questioning both the war strategy and the conflict itself, he garnered support among many politicians.
The U.S. Senate, sharply divided along political lines, approved his nomination for CIA director by 94-0 in June 2011.
Dianne Feinstein, a California Democrat who is chair of the Senate Intelligence Committee, called the resignation "an enormous loss" for the intelligence community and country.
"General Petraeus is one of America's most outstanding and distinguished military leaders and a true American patriot," Representative Peter King, a New York Republican who heads the Homeland Security Committee, said in a statement.
A fitness buff and avid runner who earned his PhD in international relations from Princeton University, General Petraeus had a distinguished 37-year military career. He co-authored the army's counterinsurgency manual, which became the blueprint for troops in Iraq under his leadership.
He also stepped in, at Mr Obama's request, to command the war in Afghanistan after Army General Stanley McChrystal resigned following an embarrassing article in Rolling Stone magazine.
General Petraeus leaves an agency embroiled in the fallout from the deaths of four US citizens, including the ambassador to Libya, in the September 11 attack on the US diplomatic compound in Benghazi. Republicans have been pressing the Obama administration, CIA and State Department for more information about what occurred during the attack.
General Petraeus was to testify at the Senate Intelligence Committee next week. He will no longer appear at the November 15 session, according to Brian Weiss, a spokesman for Feinstein. He also will not appear at a House Intelligence Committee hearing, according to a House aide.
General Petraeus, who faced his first major combat experience in Iraq in 2003, was shot in the chest during a training exercise at Fort Campbell, Kentucky, in 1991 when another soldier tripped and accidentally fired his M-16 rifle. The surgeon who operated on him was Dr Bill Frist, who later served as a Republican US senator from Tennessee.
Yesterday, Mr Obama said he wished General Petraeus and his wife, Holly, "the very best at this difficult time." The president commended Holly Petraeus, assistant director for service member affairs at the Consumer Financial Protection Bureau, helping safeguard military service members against fraud, for doing "so much to help military families through her own work".
General Petraeus and his wife met while he was a cadet at West Point. She is the daughter of General William Knowlton, who was West Point's superintendent when General Petraeus was in school. The couple have two children.
During the ceremony last year marking General Petraeus's retirement from the military, the general praised his wife for holding the family together while he was away. "She's been Mrs Dad for the bulk of the past decade," he said.
Admiral Mike Mullen, then chairman of the Joints Chiefs of Staff, said at the ceremony: "I'm sure Holly hopes this next job will last a little longer, so she can finally take the movers off speed dial."
General Petraeus becomes the latest in a line of public figures whose careers were derailed or ended by affairs. Former Senator John Edwards, a presidential candidate in 2004 and 2008, acknowledged an affair and fathering a child out of wedlock.
Senator John Ensign, a Nevada Republican, acknowledged an affair with a former campaign staffer and eventually resigned amid a Senate ethics probe. Former New York Governor Eliot Spitzer resigned after he admitted cheating on his wife with prostitutes.
Others, including President Bill Clinton, have survived extramarital activities. Mr Clinton denied having an affair with a White House intern, Monica Lewinsky, and was impeached for making false statements to federal investigators.
Mr Clinton has returned to the public stage, campaigning for Obama's re-election this year at nearly 30 events.
Ms Broadwell graduated with academic, fitness and leadership honours from West Point, according to the Penguin Speakers Bureau. During more than 15 years of military service, she has served with the US intelligence community, Special Operations Command and FBI Joint Terrorism Task Forces, the speakers bureau said.
In her book preface, posted online, she said she first met General Petraeus in 2006 as a graduate student at Harvard University's Kennedy School of Government when he was visiting Harvard.
Ms Broadwell described General Petraeus as a mentor, and said they went on "a lot of runs" in Kabul while she was researching her book. She said the general's nickname was "Peaches."
In a November 5 Newsweek article she wrote about General Petraeus's rules for living,Ms Broadwell lists as No. 5: "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".