After years of rebuilding ties to partner intelligence agencies and decades of distancing itself from a legacy of coercion of public officials, the FBI is now threatened by a new scandal of sex and betrayal, apparently brought on by a single rogue agent.

Blame is migrating toward the bureau for the downfall this week of CIA chief David Petraeus, the endangerment of the career of the top US commander in Afghanistan and the scrambling of the president's national security roster.

Petraeus' extramarital affair with biographer Paula Broadwell emerged after an unidentified agent in the FBI's Tampa, Florida, office passed news of the affair to Washington congressman David Reichert, a former law enforcement acquaintance of the agent's.

Intelligence experts fear the fallout from the affair could damage the fragile relationship between the top US intelligence agencies after years of labor to repair it.

"There is actually one danger to American national security that this case could present. One of the proximate causes of the success of the 9/11 attacks was the ceaseless war between the FBI and the CIA … they wouldn't cooperate, they couldn't talk to each other, and that was why information that could've delayed or possibly even blunted the attacks didn't get processed and analyzed and acted upon," said Tim Weiner, author of Enemies and Legacy of Ashes, bestselling histories of the FBI and the CIA. "But if I were a senior CIA officer, I'd be pretty mad about the conduct of this agent."

In a Tuesday news conference, White House spokesman Jay Carney said the president was "surprised" by the Petraeus affair. On the question of why it took months for the president to find out that the nation's top law enforcement agency was investigating the head of the CIA, Carney referred reporters to the FBI.

"They have protocols that govern how they inform the various branches of government about these investigations," Carney said. "It is simply a fact that the White House was not aware of the situation before Wednesday [7 November]."

President Obama won re-election last Tuesday, 6 November.

The relationship between Petraeus and Broadwell came to light after the FBI began investigating anonymous emails Broadwell had written to a Tampa, Florida, woman who organized social events for military personnel at MacDill air force base. Both Petraeus and General John Allen, a former deputy who succeeded him as commander in Afghanistan, were stationed at MacDill between 2008 and 2010, when Petraeus was head of US Central Command, which is has its headquarters at the base.

The FBI agent who leaked the Petraeus case has been described as a friend of the Tampa social organizer, Jill Kelley, 37, who complained that the anonymous emails were harassing in tone. FBI superiors barred the agent, whose identity has not been disclosed, from the investigation of Kelley's email because he had become obsessed with it, according to US officials. The agent had sent shirtless pictures of himself to Kelley, the Wall Street Journal reported Monday.

Officials with knowledge of the investigation reported late Monday that Kelley had also exchanged a significant number – perhaps thousands – of emails with Allen, currently the president's nominee to take command of Nato forces in Europe. That nomination is now on hold, pending a Department of Defense investigation of the matter.

Apparently frustrated with the status of the investigation of Kelley's email, the Tampa agent contacted congressman Reichert with the news that the FBI probe had uncovered an affair between Broadwell and Petraeus. Reichert passed the information to House majority leader Eric Cantor, who then passed the information to the top levels of the FBI.

What might never have left Tampa was suddenly on the desk of the FBI director, Robert S Mueller III, with the name of a congressional leader attached. Now with 11 years in the director's job, Mueller is known as a straight shooter who has kept the bureau remarkably free from scandal as its powers – and its domestic surveillance activities – have expanded in the post-9/11 era.

After hearing from Cantor, Mueller reported what the FBI knew to Obama's head of intelligence, James R Clapper. By that time Petraeus' fate was effectively sealed.

The exact nature of the relationship between the Tampa FBI agent and Reichert is unclear. Reichert, a former county sheriff, had a lead role in the investigation of the Green River killer serial murders, a case with heavy FBI involvement.

Through a spokeswoman, Reichert declined to comment. Calls and emails to the FBI's Tampa office were not returned. "The FBI is not providing any comment on this matter," a national spokeswoman said.

The FBI is conducting an internal investigation of the agent's conduct, officials said.

Weiner said the case was a reminder of the "bad old days" of the FBI under founding director J Edgar Hoover, who built influence over public officials by collecting salacious details about their private lives.

"To go from a case of cyber-bullying to effectively destroying a public figure harks back to the bad old days when Hoover ruled by fear and abused the truly awesome powers that the bureau has under law," Weiner said.

"The FBI investigation in this case never found any crime. Sex between consenting adults is not a federal crime. This FBI agent went to Congress, and took raw information about private conduct between consenting adults to the Hill.

"From what we know now, this is the case of one agent who decided that he was the law, that he knew what was best for national security, and that he and he alone should decide how this case should proceed."

The agent's identity is likely to come out, Weiner said.

"If our system works the way it's supposed to work, we will know who this gentleman is," Weiner said. "Because he's got a lot to answer for."