F.B.I. investigators uncovered evidence of an extramarital affair between former CIA chief David Petraeus and his biographer, Paula Broadwell, after the bureau began examining threatening e-mails sent to Petraeus family friend, Jill Kelley, according to the New York Times.

Kelley, a 37-year-old volunteer social liaison at MacDill Air Force Base in Tampa, Fla., went to a friend in the F.B.I. during the early portion of this past summer after receiving a half-dozen harassing e-mails sent from an anonymous address, the report said. The messages accused her of inappropriate flirtations with Petraeus.

Together, with a local United State's attorney's office, Florida F.B.I. agents began investigating whether the emails sent to Kelley constituted criminal cyber-stalking. Because of the anonymous address used by the suspect, FBI teams were forced to use forensic techniques to identify the sender, the report said

Eventually, agents linked the messages back to Paula Broadwell and discovered other sexually explicit emails from an unidentified account in her inbox. After further inquiry, it was determined that Petraeus was the author of the intimate content, though at the time agents were unsure of whether the General's account had been hacked into, the report said.

Authorities soon determined that Petraeus himself was the sender of the explicit messages and that he and Broadwell had had an affair, though they found no evidence of extramarital relations between Kelley and Petraeus.

At this point, according to Attorney General Guidelines that govern sensitive matters involving domestic law enforcement officials, F.B.I. investigators notified F.B.I. Headquarters and the Department of Justice of their investigation into the personal affairs of Petraeus, the report said.

In late October, F.B.I. agents interviewed Broadwell for the first time. They then spoke with Petraeus in early November. Both Broadwell and Petraeus admitted to having an affair with the other.

As part of the investigation, Broadwell voluntarily turned over her computer to officials who found classified documents on it, though she claimed that she did not receive them from Petraeus. Likewise, Petraeus said in interviews that he had not given any Broadwell any classified information. On that evidence, agents decided that no crime had been committed by the former C.I.A. chief, the report said.

Knowing the high-profile nature of the case and the extreme sensitivity of the matters involved, investigators took every precaution to inform the right parties when necessary about their examination.

This was very thought-through,” a senior law enforcement official told the newspaper.

With the case settled, F.B.I. agents notified Director of National Intelligence James Clapper of their progress on Election Day, Tuesday, November 6. That evening, according to Reuters, Clapper spoke with Petraeus and advised him to step down.

The next night, Reuters reports, Clapper informed the White House National Security Council about Petraeus' potential resignation and suggested to the group that President Obama be informed about the situation.

On Novemeber 7, Petraeus met with Obama to offer his resignation. The President did not immediately accept the offer. The next night, Obama called Petraeus and accepted his resignation.

In a message to the C.I.A. workforce, Patreaus told the organization that "After being married for over 37 years, I showed extremely poor judgment by engaging in an extramarital affair."

President Barack Obama also released a statement. “"By any measure, through his lifetime of service David Petraeus has made our country safer and stronger."

Petraeus, 60, and his wife, Holly, first met close friends Jill and her husband Scott Kelley in 2008 when the general was stationed at MacDill Air Force Base as commander of the U.S. military's Central Command, which runs operations in the Middle East and South Asia, several published reports said on Monday.

The Kelleys visited the Petraeuses in Washington and the Petraeuses stayed with the Kelleys in Tampa in 2010, the Tampa Bay Times reported.

"We and our family have been friends with General Petraeus and his family for over five years. We respect his and his family's privacy and want the same for us and our three children," Jill Kelley said in a statement obtained by ABC News.