The bureau probably would have ignored Kelley's complaint had it not been for information in the emails that indicated the sender was aware of the travel schedules of Petraeus and Allen, the top U.S. commander in Afghanistan. Instead, the FBI considered this from the earliest stages to be an exceptional case, and one so sensitive that FBI Director Robert Mueller and Attorney General Eric Holder were kept notified of its progress.
How the FBI's investigation unfolded especially its decision not to alert the White House, the director of national intelligence or Congress about its discovery of Petraeus' sexual affair until Election Day is under scrutiny, especially because there is no indication so far that any criminal charges will be filed.
Mueller and his deputy, Sean Joyce, have met privately with lawmakers to defend how the inquiry was handled. Holder said on Thursday that law enforcement officials did not inform the president and Congress about the probe because it did not uncover any threat to national security.
President Barack Obama said he was withholding judgment until he learns more. "You know, we don't have all the information yet," Obama said at a White House news conference. "But I want to say that I have a lot of confidence generally in the FBI." He added that it was "best right now for us to just see how this whole process is unfolding."
The FBI's cybersquads, like the one in Tampa that investigated the Petraeus case, are primarily focused on blocking criminals and terrorists from using the Internet to threaten national security or steal valuable information stored in government and corporate computers.
An AP review of court records found only nine cases over the past two years that identified cyberstalking or cyberharassment as the underlying crime in federal criminal complaints.
"They turn people away all the time on the grounds that [cyberstalking] is a civil matter, not a criminal one," said Danielle Citron, a professor at the University of Maryland School of Law who studies cyberharassment issues.
But the FBI considered Kelley's complaint significant and for good reason, said David Laufman, a former federal prosecutor who handled national security cases. "Most cases aren't going to get this level of attention or resources," he said. "But most cases don't involve the incumbent director of the CIA or the head of U.S. military forces in Afghanistan."
The first anonymous emails, which the FBI ultimately traced to Paula Broadwell, an Army reservist and Petraeus' biographer, were sent in May to Allen and several other generals warning them to stay away from Kelley. The emails came from the pseudonym "Kelleypatrol" and included notes on Allen's plans to see Kelley in Washington the following week. Concerned about how anyone else would know about his personal plans, Allen forwarded the emails to Kelley to see whether she was playing a prank on them. Other generals also forwarded to Kelley copies of emails they received.
In early June, Kelley herself received the first of five emails sent from different anonymous accounts alleging that she was up to no good. One of the messages cited Petraeus by name and mentioned an upcoming social visit they had planned in Washington. The mysterious emails were sent to Kelley's personal account and to a separate account she jointly monitored with her husband.
Kelley contacted an FBI agent in Tampa who she had met years earlier. The bureau believed the emails were serious because they suggested the mysterious sender knew about upcoming meetings of the CIA director and a Marine Corps general.
Agents examined the digital fingerprints that emails leave behind and eventually determined Broadwell had sent the messages from an account set up with a fictitious name. As the agents looked further, they came across a private Gmail account that used an alias name. It turned out to be Petraeus'. The contents of several of the exchanges between Petraeus and Broadwell indicated they were having an affair. A search of Broadwell's computers also found classified documents.
The Petraeus case has drawn attention to how easy it is for the government to examine emails and computer files if they believe a law was broken. The FBI and other investigating agencies armed with subpoenas and warrants routinely gain access to email accounts offered by Google, Yahoo and other Internet providers.
Civil liberties groups have criticized the FBI for pursuing the investigation of the emails to Kelley because there is no indication the messages contained any threatening language or classified information. The episode underscores the need to strengthen the legal protections for electronic communications, according to the American Civil Liberties Union.
Federal agencies can obtain a substantial amount of information about the online activities of an individual without getting a warrant from a judge. A subpoena approved by a federal prosecutor is usually sufficient to get access to stored emails and login data.
"These are invasive powers that need to have a check against overuse and abuse," said Chris Soghoian, a senior policy analyst at the ACLU. "And that check should be a judge."
The Senate Judiciary Committee is meeting later this month to consider legislation that would do just that. The bill would require a warrant for all Internet communications. Law enforcement officials have resisted the change. But all the attention from the Petraeus case could give proponents of the legislation the momentum they need to push the bill through.