The sex scandal that ended the career of CIA director Gen. David Petraeus last week began with an FBI agent in Florida investigating a case of possible cyberstalking.
From there, the trail led to pseudonymous Gmail accounts, an elaborate matching game involving Internet Protocol addresses and possible requests to Google for private customer information.
At least one Gmail account was shared by Petraeus and his alleged paramour, Paula Broadwell, replicating an old email trick popularized by al-Qaida.
Although much of the information regarding the case has come out since Friday, one question is still unanswered: Why did the FBI get involved in a small-time cyberstalking case in Florida?
And why did the still-unnamed FBI agent who initiated the investigation feel so aggrieved two weeks ago that he complained to a congressman that the investigation had stalled?
In May of this year, Jill Kelley, a Tampa woman who serves as the honorary social director at MacDill Air Force Base (an unpaid position), told a friend who happened to be an FBI agent that she had been receiving threatening emails.
The hostile, but anonymous, emails accused Kelley, 37, of being flirtatious with an unnamed man and warned her to stay away.
Kelley and her husband knew Petraeus and his wife socially from Petraeus' stint from 2008 to 2010 as commander of U.S. Central Command, which is based at MacDill.
Kelley reached out to an FBI agent who was a personal friend. He got an investigation started, and the local prosecutors and FBI agents working on the case soon traced the nasty emails to an account Broadwell shared with her husband.
"I'm not aware of any case when the FBI has gotten involved in a case of online harassment," Justin Patchin, an associate professor of criminal justice at the University of Wisconsin-Eau Claire, told Wired's Kim Zetter. "The FBI definitely wouldn't get involved in your Joe Schmoe love triangle."
It's possible that Kelley had figured out Petraeus was the unnamed man discussed in the emails and told the FBI, which would instantly have made the case a priority.
But multiple media reports indicate that FBI agents were surprised later in the investigation to discover Petraeus' involvement. (Kelley has denied any sort of romantic relationship with Petraeus.)
The FBI agent was later thrown off the case because it turned out he had emailed shirtless photographs of himself to Kelley, the Wall Street Journal reported Monday night (Nov. 12).
In an even more bizarre twist, Secretary of Defense Leon Panetta informed reporters early this morning (Nov. 13) that a second general, Gen. John R. Allen, was under investigation for "inappropriate communication" with Kelley.
Unnamed defense officials told The New York Times that Allen, a Marine who replaced Petraeus as the top NATO commander in Afghanistan, had generated between 20,000 and 30,000 pages of emails and other documents in his communications with Kelley.
Like Broadwell, Petraeus and Kelley, Allen is married.
Between five and 10 threatening emails were received by Kelley. FBI agents built up a list of the Internet Protocol addresses the emails had been sent from over time and correlated it with a timeline of Broadwell's travels. They matched.
It's not clear whether the agents gleaned the IP addresses from the emails themselves, or requested and received the information from Google. A Reuters report Monday indicated that no court-ordered warrants were involved, but many Internet companies hand over information without one.
From there, the FBI agents' next step was to gain access to Broadwell's regular email account. Again, it's not clear if a court was involved or if Google or another email provider gave the FBI access willingly.
At that point, the agents discovered sexually charged emails from an unnamed man in Broadwell's account. The man had used another pseudonymous account.
By August, the FBI had figured out that Petraeus was the owner of the newly discovered Gmail account.
They considered two possibilities: that Petraeus and Broadwell were having an affair, or that Petraeus' Gmail account had been hacked.
The latter possibility was ruled out, leading the FBI to notify higher-ups in the Department of Justice, including Attorney General Eric Holder.
It also appeared that Broadwell herself had access to Petraeus' account, which briefly made her a hacking suspect.
But instead of actually sending emails to each other, as the Associated Press reported Monday, Petraeus and Broadwell simply shared a single Gmail account.
One would compose a draft email, but not send it, according to an unnamed law enforcement official. The other would later log into the account, read the draft, and compose a reply.
The technique was often used by al-Qaida operatives over the past decade to avoid being traced. Unlike al-Qaida, however, Petraeus or Broadwell had used the account to send emails to Broadwell's regular email account, which led the FBI to the shared account.
In early fall — media accounts vary on the exact timing — Broadwell was interviewed by the FBI and admitted the affair. She said it had begun late in 2011, after Petraeus had taken command of the CIA and retired from the Army.
Broadwell also said the affair had ended in June or July of this year, which would be after Kelley had received the threatening emails and the FBI probe had begun.
Broadwell willingly surrendered her laptop, which was found to contain classified material. She denied receiving the material from Petraeus.
In his own FBI interview in late October, Petraeus also admitted the affair but denied having given any classified documents to Broadwell.
At around the same time, the FBI agent who was a personal friend of Jill Kelley's had grown frustrated at what appeared to a stalling investigation. He reached out to Rep. David Reichert (R-Wash.), telling Reichert what he knew, and Reichert in turn informed House Majority Leader Eric Cantor (R-Va.).
Cantor spoke to the FBI agent around Oct. 31 and then informed FBI Director Robert Mueller that national security might be at stake.
For the next week, nothing happened as the nation prepared for the presidential election.
On Nov. 7, the morning after President Barack Obama's re-election, the White House was notified. The president learned of the matter the next day upon his return from Chicago and called Petraeus, who offered to resign.
Obama considered the matter overnight and then called Petraeus the following day, Nov. 9, to accept Petraeus' resignation.
Last night, despite the general insistence that no crime had been committed by anyone, the FBI raided Broadwell's home in Charlotte, N.C. Broadwell and her family were not home.
This story was provided by TechNewsDaily, sister site to LiveScience.