WASHINGTON — The scandal that brought down CIA Director David Petraeus started with harassing emails sent by his biographer and paramour, Paula Broadwell, to another woman, and eventually led the FBI to discover the affair, a U.S. official told The Associated Press on Saturday.

Petraeus resigned Friday after acknowledging an extramarital relationship.

The official said the FBI investigation began several months ago with a complaint against Broadwell, a 40-year-old graduate of the U.S. Military Academy and an Army Reserve officer. That probe led agents to her email account, which uncovered the relationship with the 60-year-old retired four-star general, who earned acclaim for his leadership of the wars in Iraq and Afghanistan.

The identity of the other woman and her connection with Broadwell were not immediately known.

Concerned that the emails he exchanged with Broadwell raised the possibility of a security breach, the FBI brought the matter up with Petraeus directly, according to the official, who spoke on condition of anonymity because he was not authorized to publicly discuss the investigation. 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.

Petraeus decided to quit, abruptly ending a high-profile career that might high culminated with a run for the presidency.

Petraeus 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 and Senate intelligence committees were briefed, officials say.

By Friday evening, multiple officials identified Broadwell, who spent the better part of a year reporting on Petraeus’ time in Afghanistan.

Members of Congress said they want answers to questions about the affair that led to Petraeus’s resignation.

House intelligence committee chairman Mike Rogers, R-Mich., and ranking member Dutch Ruppersberger, D-Md., will meet Wednesday with FBI deputy director Sean Joyce, and CIA acting director Michael Morell to ask questions, including how the investigation came about, according to a senior congressional staffer who spoke anonymously because he was not authorized to discuss the investigation publicly.

Petraeus has been married for 38 years to Holly Petraeus, the daughter of the West Point superintendent when he was a student at the New York school.

“He is truly remorseful about everything that’s happened,” said Steve Boylan, a retired army officer and former Petraeus spokesman who spoke with the former general on Saturday. In a phone call with Boylan Saturday, Petraeus lamented the damage he’d done to his “wonderful family” and the hurt he’d caused his wife.