Mr Petraeus quit his post as director of the CIA on Friday while offering an apology over the affair with his biographer, Paula Broadwell, who is 20 years his junior. The retired four-star general's apology came as reports in the US showed the affair was uncovered after Ms Broadwell allegedly sent the emails to another woman she accused of getting too close to him.
The recipient of those emails, fearing for her safety, contacted the FBI – which found Ms Broadwell had sent them.
A government official told the New York Post the emails contained phrases such as: "I know what you did", "back off" and "stay away from my guy".
The FBI investigation began several months ago with a complaint against Ms Broadwell, 40, a graduate of the US Military Academy at West Point and an army reserve officer.
That probe led agents to her email account, which uncovered the relationship with Mr Petraeus, 60, who has been acclaimed for his leadership of the wars in Iraq and Afghanistan.
Concerned the emails he exchanged with Ms Broadwell raised the possibility of a security breach, the FBI brought the matter up with Mr Petraeus directly, according to the official.
The FBI approached the CIA director because his emails in the matter were in most instances sent from a personal account, not his CIA one. Mr Petraeus decided to resign, abruptly ending a high-profile career that might have culminated in a run for the US presidency, a notion he was believed to be considering.
"Such behaviour is unacceptable, both as a husband and as the leader of an organisation such as ours," Mr Petraeus wrote to his staff. He handed his resignation letter to President Barack Obama on Thursday, stunning many in the White House, the CIA and Congress. The news broke in the media before the House of Representatives and Senate intelligence committees had been briefed, officials say.
By Friday evening, many officials identified Ms Broadwell, who spent the better part of a year reporting on Mr Petraeus's time in Afghanistan.
Mr Petraeus has been married for 38 years to Holly Petraeus, whose father was the superintendent of West Point when he was a student at the New York academy. "He is truly remorseful about everything that's happened," said Steve Boylan, a retired army officer and former Petraeus spokesman.
Ms Broadwell interviewed the general and associates for more than a year to produce the biography All In: The Education Of General David Petraeus.
Ms Broadwell, who is married with two sons, has not responded to requests for comment.