But law enforcement officials did not notify anyone outside the FBI or the Justice Department until last week because the investigation was incomplete and initial concerns about possible security breaches, which would demand more immediate action, did not appear to be justified, the officials said.
The new accounts of the events that led to Petraeus' sudden resignation on Friday shed light on the competing pressures facing FBI agents who recognized the high stakes of any investigation involving the CIA director but who were wary of exposing a private affair with no criminal or security implications. For the first time Sunday, the woman whose report of harassing emails led to the exposure of the affair was identified as Jill Kelley, 37, of Tampa, Fla.
Some members of Congress have protested the delay in being notified of the FBI's investigation of Petraeus until just after the presidential election. Sena. Dianne Feinstein, D-Calif., the chairwoman of the Intelligence Committee, said Sunday that her committee would "absolutely" demand an explanation. An FBI case involving the CIA director "could have had an effect on national security," she said on Fox News Sunday. "I think we should have been told."
But the bureau's history would make the privacy question especially significant; in his decades-long reign as the FBI's first director, J. Edgar Hoover sometimes directed agents to spy improperly on the sex lives of public figures and then used the resulting information to pressure or blackmail them.
Law enforcement officials, who spoke on condition of anonymity because of the delicacy of the investigation, defended the FBI's handling of the case.
"There are a lot of sensitivities in a case like this," said a senior law enforcement official. "There were hints of possible intelligence and security issues, but they were unproven. You constantly ask yourself, 'What are the notification requirements? What are the privacy issues?"'
A close friend of the Petraeus family, said Sunday that the intimate relationship between Petraeus and his biographer, Paula Broadwell, began after he retired from the military last year and about two months after he began work as CIA director. It ended about four months ago, said the friend, who did not want to be identified while discussing personal matters. In a letter to the CIA workforce on Friday, Petraeus acknowledged having the affair. Broadwell has not responded to repeated requests for comment.
Under military regulations, adultery can be a crime. At the CIA, it can be a security issue, since it can make an intelligence officer vulnerable to blackmail, but it is not a crime.
The same Petraeus family friend confirmed on Sunday the identity of Kelley, whose complaint to the FBI about "harassing" emails, eventually traced to Broadwell, set the initial investigation in motion several months ago. Kelley, along with her husband, became friends with Petraeus and his wife, Holly, when Petraeus was head of the military's Central Command, which has its headquarters at MacDill Air Force Base in Tampa.
"We and our family have been friends with General Petraeus and his family for over five years," Kelley and her husband, Scott Kelley, said in a statement released Sunday. "We respect his and his family's privacy, and want the same for us and our three children."
The statement did not acknowledge that it was Kelley who received the emails, which was first reported by The Associated Press.
The involvement of the FBI, according to government officials, began when Kelley, alarmed by about half a dozen anonymous emails accusing her of inappropriate flirtatious behavior with Petraeus, complained to an FBI agent who is also a personal friend. That agent, who has not been identified, helped get a preliminary inquiry started. Agents working with federal prosecutors in a local U.S. attorney's office began trying to figure out whether the emails constituted criminal cyber-stalking.
Because the sender's account had been registered anonymously, investigators had to use forensic techniques - including a check of what other email accounts had been accessed from the same computer address - to identify who was writing the emails.
Eventually they identified Broadwell as a prime suspect and obtained access to her regular email account. In its inbox, they discovered intimate and sexually explicit emails from another account that also was not immediately identifiable. Investigators eventually ascertained that it belonged to Petraeus and studied the possibility that someone had hacked into Petraeus' account or was posing as him to send the explicit messages.
Eventually they determined that Petraeus had indeed sent the messages to Broadwell and concluded that the two had had an affair. Then they turned their scrutiny on him, examining whether he knew about or was involved in sending the harassing emails to Kelley.
It was at that point - sometime in the late summer - that lower-level Justice Department officials notified supervisors that the case had become more complicated, and the Criminal Division's Computer Crime and Intellectual Property Section began working on the investigation as well.
It remains unclear whether the FBI also gained access to Petraeus' personal email account, or if it relied only on emails discovered in Broadwell's in-box. It also remains uncertain exactly when the information about Petraeus reached Attorney General Eric H. Holder Jr. and Robert S. Mueller III, the FBI director. Both men have declined to comment.
But under the Attorney General Guidelines that govern domestic law enforcement officials, agents must bring to the attention of FBI headquarters and the Department of Justice whenever they are looking at a "sensitive investigative matter," which includes cases "involving the activities of a domestic public official."
FBI agents interviewed Broadwell for the first time the week of Oct. 21, and she acknowledged the affair, a government official briefed on the matter said. She also voluntarily gave the agency her computer. In a search of it, the agents discovered several classified documents, which raised the additional question of whether Petraeus had given them to her. She said that he had not. Agents interviewed Petraeus the following week. He also admitted to the affair but said he had not given any classified documents to her. The agents then interviewed Broadwell again on Friday, Nov. 2, the official said.
Based on that record, law enforcement officials decided there was no evidence that Petraeus had committed any crime and tentatively ruled out charges coming out of the investigation, the official said. Because the facts had now been settled, the agency notified James R. Clapper, the director of national intelligence, about 5 p.m. on the following Tuesday - Election Day.
Meanwhile, the FBI agent who had helped get a preliminary inquiry started and learned of Petraeus' affair and initial concerns about security breaches became frustrated. Apparently unaware that those concerns were largely resolved, the agent alerted the office of Rep. Eric Cantor, the House majority leader, about the inquiry in late October. Cantor passed on the concerns to Mueller.
Cantor revealed Saturday that he had talked with the FBI agent.
Officials said Sunday that the timing of notifications had nothing to do with the election, noting that there was no obvious political advantage for either President Barack Obama or Mitt Romney in the news that the CIA director had had an affair; Petraeus is highly regarded by both Republicans and Democrats. They also said that Cantor's call to the FBI on Oct. 31 had not accelerated or otherwise influenced the investigation, which they said had never stalled.
FBI and Justice Department officials knew their handling of the case would ultimately receive immense scrutiny and took significant time to determine whom they were legally required to inform, according to a senior law enforcement official.
"This was very thought-through," the official said.
Because the investigation raised the possibility of serious security breaches, including the compromise of the CIA director's email account and the possession of classified documents by Broadwell, there was a case for immediate notification. The law requires that the Senate and House intelligence committees be kept "fully and currently informed" of intelligence activities.
But Justice Department and FBI rules, designed to protect the integrity of investigations and the privacy of people who come under scrutiny, say that investigators should not share potentially damaging information about unproved allegations or private matters unless it is critical for the investigation.
Glenn A. Fine, the inspector general for the Justice Department from 2000 to 2011, said it appeared that the FBI was "legitimately following a lead" about possible criminal wrongdoing or a security breach.
"Some have said the FBI was out to get the CIA," said Fine, who is now a partner at the law firm Dechert LLP in Washington. "That might have been true 20 years ago. But it is hard to believe that is going on today."
John Prados, a historian and author on intelligence and its abuses, said the case "posed several dilemmas for the FBI" that would have prompted agents and their bosses to proceed gingerly.
"Petraeus is a very important person, so they would want to be crystal-clear on exactly what happened and what the implications were," Prados said. "There was probably a sense that it had to be taken to top bureau officials. And bureau officials probably thought they had better tell the White House and Congress and the DNI, or they might get in trouble later," he added, referring to the director of National Intelligence.
But if the security issues were resolved and no crime had been committed, Prados said, there was no justification for informing Congress or other agencies that Petraeus had an affair.
"In my view, it should never have been briefed outside the bureau," he said.
(Michael S. Schmidt, Eric Schmitt, Mark Mazzetti and Michael R. Gordon contributed reporting.)