An FBI probe into unauthorized access to the David Petraeus’ email account led investigators to discover an extramarital affair, reported to be with his biographer Paula Broadwell. Petraeus resigned Friday, bringing his career in public service -- which included leading U.S. troops in Iraq and Afghanistan and a rumoured future run for president – to an abrupt end.

In a statement, Petraeus told his staffers he was guilty of “extremely poor judgement” for engaging in the affair. “Such behaviour is unacceptable, both as a husband and as the leader of an organization such as ours.”

Petraeus told his fellow CIA employees that he treasured his work with them and “I will always regret the circumstances that brought that work with you to an end.”

Mistress is Petraeus’ biographer: U.S. officials

Speaking anonymously, U.S. officials who are familiar with the situation said Petraeus carried on the affair with a reserve Army officer, Paula Broadwell, who also acted as his biographer.

The biography co-authored by Vernon Loeb, “All In: The Education of general David Petraeus,” was published in January.

In the preface of the book, Broadwell said she first met Petraeus’ in the spring of 2006. Broadwell was studying at the Kennedy School of Government at Harvard and Petraeus’ was visiting the university to discuss his experiences in Iraq. Broadwell was invited to meet with him because of her military background.

Broadwell spent time with the U.S. intelligence community, U.S. Special Operations Command and FBI Joint Terrorism Task Forces. During her more than 15 years of military service, she was recalled to active duty on three separate occasions to work on counterterrorism issues after the Sept. 11 attacks.

After introducing herself to Petraeus, he gave her his card and offered to connect her with others working on similar issues that related to her research studies at Harvard. The two kept in contact as Broadwell said she took full advantage of his open-door policy to seek insight. 

The two met up in 2008 when Broadwell was working on her PhD in public policy and using a case study of Petraeus’ leadership. Petraeus’ invited her to run along the Potomac River with his team while he was in Washington. After Petraeus was put in charge in Afghanistan in 2010, Broadwell expanded this research to become an authorized biography.

In a January interview with The Daily Show, Broadwell described frequent runs she took with the General, while she was embedded in Afghanistan.

“This is a typical mechanism he uses to get to know young people, he’s done it throughout his life. So it was an opportunity for me to interview him on a run,” she said. “And I thought I’d test him, but he was going to test me and it ended up being a kind of test for both of us since we both ran pretty quickly. But that was the foundation of our relationship.”

In another report, Broadwell’s husband is suspected of writing into the New York Times’ Ethicist advice column asking for advice concerning his unnamed wife who is having “an affair with a government executive.”

In the letter, the author writes that the executive’s roles “is to manage a project whose progress is seen worldwide as a demonstration of American leadership. (This might seem hyperbolic, but it is not an exaggeration.)”

It later continues: “He is engaged in work that I am passionate about and is absolutely the right person for the job. I strongly feel that exposing the affair will create a major distraction that would adversely impact the success of an important effort.

“Should I acknowledge this affair and finally force closure?”

CIA deputy director Morell to replace Petraeus

The FBI became aware of the relationship between Petraeus and Broadwell after monitoring Petraeus’ emails, following an alert that Broadwell may have accessed his personal account, said two U.S. officials.

Broadwell did not respond to voicemail or email messages from The Associated Press seeking comment.

Both Democratic and Republican lawmakers joined the president in praising Petraeus. In a statement, Obama said Petraeus had provided “extraordinary service to the United States for decades” and had given a lifetime of service that “made our country safer and stronger.”

CIA Deputy Director Michael Morell will step into Petraeus’ role and serve as acting director, said Obama. Morell was the key CIA aide in the George W. Bush administration during the 9-11 terror attacks.

"I am completely confident that the CIA will continue to thrive and carry out its essential mission," said Obama.

Petraeus’ resignation comes at a particularly sensitive time. The administration and the CIA have been criticized for intelligence lapses prior to the Benghazi embassy attack that killed four on Sept. 11, including the U.S. ambassador to Libya.

The issue surfaced during the presidential campaign, which Obama won last Tuesday.

The CIA came under scrutiny for providing the White House with talking points that led them to say the attack in Benghazi was a result of a protest over an anti-Islam film, not a militant terror attack.

It has since become clear that the CIA was aware the attack was separate from the film protests plaguing other areas of the Muslim world.

Petraeus was scheduled to testify on the Benghazi attacks at congressional briefings next week. Now, Morell is expected to testify in his place.

Extramarital affair considered a security breach

The 60-year-old Petraeus met his wife Holly while he was a cadet at the U.S. Military Academy at West Point, N.Y. She was the daughter of the academy’s superintendent. The two have been married for 37 years and have two children together.

Though Obama made no reference to the reason why Petraeus was resigning, he offered his thought and prayers to the general and his wife.

The president praised Holly Petraeus, saying she had “done so much to help military families through her own work. I wish them the very best at this difficult time.”

Holly Petraeus joined the Consumer Financial Protection Bureau to help set up an office dedicated to aiding service members with financial issues.

White House officials said they were first notified about the affair on Wednesday, just one day after Obama won the election. The president was informed of the affair Thursday morning.

Engaging in an extramarital affair is considered a serious breach of security and a counterintelligence threat for the director of the CIA.

If a foreign government learned of the affair, Petraeus or Broadwell could have been blackmailed. Conduct such as extramarital affairs are considered possible grounds for court martialling according to military justice.

Failure to resign after engaging in an affair could also create the perception that such behaviour is acceptable.

FBI spokesman Paul Bresson did not comment on the manner in which the bureau had discovered the affair.

Petraeus, who became the CIA director in September 2011, was known as an astute thinker and tough competitor. In a recent Newsweek article by Broadwell, his management style was praised.

In the article, Broadwell outlines Petraeus’ “rules for living.” The fifth rule was listed as “we all make mistakes. The key is to recognize them, to learn from them, and to take off the rear view mirrors – drive on and avoid making them again.”

Petraeus’ career remembered

Since announcing his resignation, many other U.S. officials joined the president in praising the retired general.

Director of national intelligence James Clappers said Petraeus’ departure was “the loss of one of our nation's most respected public servants. From his long, illustrious Army career to his leadership at the helm of CIA, Dave has redefined what it means to serve and sacrifice for one's country."

Before becoming head of the CIA, Petraeus was credited with turning around the U.S. war in Iraq.

"His inspirational leadership and his genius were directly responsible -- after years of failure -- for the success of the surge in Iraq," Sen. John McCain, R-Ariz., said Friday.

In February 2007, Petraeus was sent to Iraq to address sectarian violence which had reached a peak. He managed an influx of 30,000 U.S. troops and moved troops out of big bases and placed them throughout Baghdad, so they could work more closely with Iraqi forces.

His work is credited for paving the way for the eventual U.S. withdrawal from Iraq.

In June 2010, Obama asked Petraeus to take over in Afghanistan. While in Kabul, Petraeus pushed for more U.S. troops and helped boost the effort to train Afghan soldiers and police.

Senate Intelligence Committee Chairman Dianne Feinstein, D-Calif., said she regretted Petraeus’ resignation but praised his replacement Morell.

"I wish President Obama had not accepted this resignation, but I understand and respect the decision,” said Feinstein.

With files from The Associated Press