WASHINGTON (CNN) -- The career-ending affair that led to the resignation of CIA Director David Petraeus had its roots in a multi-year friendship, a flattering book and a young writer who was taken with the four star-general's leadership style.
The affair came to light during an FBI investigation of a complaint that author Paula Broadwell, 40, was allegedly sending harassing e-mails to another woman close to Petraeus, a U.S. official said. Here's a look at an anatomy of an affair:
Spring 2006 Broadwell met Gen. David Petraeus when he spoke at Harvard, where she was a graduate student, according to the preface she co-authored the book "All In: The Education of General David Petraeus." She told the general about her research interests and he agreed to put her in touch with people studying the same issues. "I later discovered that he was famous for this type of mentoring and networking, especially with aspiring soldier-scholars," Broadwell wrote.
2008 Broadwell began her Ph.D. dissertation on Petraeus and his innovative leadership skills. Some interviews were done via e-mail. Others were conducted on occasional jogs with him, including one run Broadwell took with Petraeus and his team along the Potomac River in Washington.
2009 Broadwell moved with her husband, Scott, to Charlotte, North Carolina, according to the Charlotte Observer.
June 2010 Petraeus was tapped to replace Gen. Stanley McChrystal as the top commander in Afghanistan. Broadwell decided to turn her research into a book and follow Petraeus to that country. "We had a relationship before I went there as far as this dissertation was concerned, so it just took it to another level," Broadwell told CNN's Brooke Baldwin in February.
August 31, 2011 Petraeus retires from the U.S. Army, leaves Afghanistan.
September 6, 2011 Petraeus sworn in as CIA director and returns to the Washington area.
October/November 2011 Petraeus and Broadwell began their affair about two months after he took over at the CIA, according to a Petraeus friend.
May 2012 E-mails began appearing in Petraeus family friend Jill Kelley's inbox---emails she says were harassment. The Petraeus affair first came to light when an FBI investigation looked into a complaint that Broadwell was sending harassing e-mails to Kelley, 37, a U.S. official said.
Summer 2012 Broadwell and Petraeus end their affair about four months ago, a decision reached mutually, and the two last talked about a month ago, Petraeus' friend said.
September 11, 2012 U.S. Ambassador to Libya Christopher Stevens and three other Americans were killed in a terrorist attack on the U.S. diplomatic mission in Benghazi. The subsequent fallout fueled Republican criticism of the Obama administration's foreign policy. The administration pointed to incomplete intelligence reports for early statements that the attack grew from a demonstration over an anti-Muslim movie.
September/October 2012 Broadwell was interviewed twice by FBI investigators. They also gained access to her computer and discovered emails that turned out to be from Petraeus. Petreaus was also interviewed once during that same time frame, a U.S. official said.
October 2012 House Majority Leader Eric Cantor was made aware of an extramarital affair involving Petraeus, Doug Heye, a spokesman for the congressman, told CNN. Heye said Cantor, a Republican, was tipped to the information by an FBI employee. The congressman had a conversation with the official, described as a whistle-blower, about the affair and potential national security concerns involved in the matter, he said.
November 6, 2012 America re-elects President Barack Obama. The same day, Petraeus told Director of National Intelligence James Clapper about the affair, according to a senior U.S. intelligence official. Clapper then advised Petraeus to resign, the official said.
November 9, 2012 Petraeus, 60, steps down, admitting to an affair. The House and Senate intelligence committees were informed of the FBI investigation the same day, prompting outrage from House and Senate members. Petraeus' resignation came just days before he was scheduled to testify before the Senate Intelligence Committee about the Benghazi attack.
CNN's Dana Ford, Phil Gast, Michael Pearson, Carol Cratty, wires and staff contributed to this report.