WASHINGTON — The FBI investigation that led to the resignation of David H. Petraeus as CIA director Friday began with a complaint several months ago about ‘‘harassing’’ e-mails sent by Paula Broadwell, Petraeus’ biographer, to an unidentified third person, a government official briefed on the case said Saturday.
When FBI agents following up on the complaint began to examine Broadwell’s e-mails, they discovered exchanges between her and Petraeus that revealed they were having an affair, said the official, who spoke of the investigation on the condition of anonymity.
The person who complained about harassing messages from Broadwell, according to the official, was not a family member or a government official. One congressional official who was briefed on the matter Friday said senior intelligence officials had explained that the FBI investigation ‘‘started with two women.’’
''It didn’t start with Petraeus, but in the course of the investigation they stumbled across him,’’ said the congressional official, who said the intelligence officials had provided no other information about the two women or the focus of the inquiry. ‘‘We were stunned.’’
Petraeus said in a statement that he was resigning after 14 months as head of the CIA because he had shown ‘‘extremely poor judgment’’ in engaging in the affair after 37 years of marriage.
The government official dismissed a range of media speculation that the FBI inquiry might have focused on leaks of classified information to the press or even foreign spying. ‘‘People think that because it’s the CIA director, it must involve bigger issues,’’ the official said. ‘‘Think of a small circle of people who know each other.’’
The FBI investigators were not pursuing evidence of Petraeus’ marital infidelity, which would not be a criminal matter, the official said. But their examination of his e-mails, most or all of them sent from a personal account and not from his CIA account, raised the possibility of security breaches that needed to be addressed directly with him.
‘'Alarms went off on larger security issues,’’ the official said. As a result, FBI agents spoke with the CIA director about two weeks ago, and he learned in the discussion, if he was not already aware, that they knew of his affair with Broadwell, the official said.
The fears of bigger security problems proved unjustified, and the security questions were resolved, the official said.
Neither the congressional intelligence committees nor the White House learned of the investigation or the link to Petraeus until this week, officials said.