Karen Bleier / AFP / Getty Images CIA Director David Petraeus testifies before the U.S. Senate Intelligence Committee during a full committee hearing on "World Wide Threats" in Washington, D.C. Jan. 31, 2012

Paula Broadwell stepped off the stage at the Aspen Security Forum on July 28, fresh from criticizing the news media for heedless disclosure of secrets. The afternoon program of seminars was packed with admirals, generals and Cabinet chiefs, but Broadwell had pressing business elsewhere. She ducked out of the conference, slipped into running shorts and jogged off in search of a once-in-a-­lifetime birthday present.

Broadwell and CIA Director David Petraeus had fallen into an extramarital affair after years of close contact as biographer and subject. Born two days and 20 years apart, they had big benchmarks approaching—his 60th, her 40th—and Broadwell was looking for a suitably momentous gift. As she had tweeted proudly a few days before, Broadwell had a date for a “1v1 run with Lance Armstrong.” What she did not mention was her plan to recruit Armstrong for a surprise birthday bike ride with the fitness-mad Petraeus. If all went as she planned, the retired four-star general would ride into his seventh decade alongside cycling’s greatest star.

(LIST: Who’s Who in the David Petraeus ‘Love Pentagon’ Scandal)

That particular ride was not to be. By then, though they did not know it yet, disgrace was bearing down on all three of them. Tampa socialite Jill Kelley, alarmed by a series of disturbing e-mails from someone self-identifying as “kelley­patrol,” had filed an FBI complaint in May. Electronic metadata pinpointing the times and places and IP addresses associated with Kelley’s hidden correspondent identified Broadwell as the author. Investigators scooped up gigabytes of content from her other accounts—some under Broadwell’s name, others under aliases. As FBI agents sifted through the harassing e-mails, they found discussion of the movements and activities of high-level military officials—and of Petraeus. “So that sparked the interest of the investigative agencies,” says a law-enforcement official. Some of the exchanges were sexually charged. By that point the implications extended far past a domestic dispute into the highest reaches of national security.

Photograph by Marco Grob for TIME

Already the costs have been stunning. Marriages and reputations have been fractured. Multiple careers, including those of the CIA director and a four-star general, have been damaged or destroyed. The decision by FBI Director Robert Mueller and Attorney General Eric Holder Jr. to withhold notice about the case until Election Day has turned congressional attention once again on the inner workings of the Obama Administration. Intelligence Committee members in Congress are furious at having been kept in the dark, and the furor has strained relations between lawmakers and the White House at the very moment voters want to see them sit down together to get something done. The U.S.’s entire security apparatus seems rattled. And every news cycle brings new questions about the judgment, morals, methods and command focus of some of America’s most powerful public servants.

Obama lost his CIA director just as the rest of his national-security team was in motion as well: Hillary Clinton is preparing to leave the State Department, and replacing her is likely to involve further shuffling of key players. And this was not just any CIA director but a man with long experience of command in the Middle East and South Asia, at a moment of intense focus on Libya, Syria and the looming pullout from Afghanistan. Obama was also losing one of the most experienced operators of and thinkers on lethal drones for targeted killing, the President’s chosen tool against al-Qaeda. And all this comes as complex problems in Iran and China await Obama’s attention. A President who had hoped to pivot to a second term of bipartisan purpose found himself dodging questions about how his team had handled the far-reaching implications of a love affair.

(MORE: Jill Kelley: Military Liaison and Whistleblower in Petraeus Scandal)

“The Party Is Canceled”

For Petraeus, there would be no birthday celebration. On Nov. 7, the day he turned 60, he was preparing for his meeting with Obama the following afternoon, when he would tender his resignation. Two days later, when Broadwell turned 40, Petraeus publicly announced that he was stepping down after “engaging in an extramarital affair.” Broadwell was at a birthday dinner with her husband at the Inn at Little Washington in Virginia on the night news reports identified her as the woman involved. A hasty e-mail that evening from her husband to guests invited for a larger celebration said simply, “The party is canceled on Saturday. Thanks!”

Yet that was just the beginning. Friends and family said Jill Kelley was filled with remorse at her complaint’s unexpected impact on Petraeus, a longtime friend. The same forensic techniques that led to Petraeus’ resignation unearthed what Defense Department officials described as 20,000 to 30,000 pages of messages between Kelley and Marine General John Allen, who was deputy chief of the ­Tampa-based U.S. Central Command and then succeeded Petraeus as commander of U.S. and allied forces in Afghanistan. Those astonishing numbers, government experts said, greatly exaggerated the ­frequency of communication because the strict formatting requirements for documentary evidence mandated the inclusion of full headers, signatures and repetitive e-mail chains. Even so, there were at least hundreds of exchanges.

Allen, through associates, denied an affair with Kelley, a married mother of three. Some officials hinted, without specifying how, that the e-mails and other exchanges raise questions of impropriety. The brou­haha was enough to put Allen’s nomination as NATO’s Supreme Allied Commander on hold. While Obama issued a statement expressing confidence in Allen, it is no longer certain who will hold the top U.S. military assignment in Europe.

MORE: Paula Broadwell, David Petraeus’ Biographer and Alleged Mistress