He was lauded as the greatest soldier-scholar of his generation, a highly decorated general who was as at home negotiating the intrigues of Washington as the trenches of Iraq and Afghanistan.
She was a fellow West Point graduate, a counter-terrorism expert, a fitness champion and a tall, striking brunette two decades his junior who had modelled for a machine gun manufacturer.
Now the career of General David Petraeus has ended in the tawdry disgrace of a sex scandal after he stunned the US military, intelligence and political establishments with his resignation as America's spy chief because of an extramarital affair.
His reported mistress, Paula Broadwell, was the co-author of a fawning recent biography of the general, who resigned on Friday as director of the Central Intelligence Agency. Both are married with children.
In a remarkable twist, it was agents from the Federal Bureau of Investigation who discovered that the head of the CIA was conducting an affair during an inquiry into possible email security breaches.
What prompted the FBI to open its investigation is still emerging. According to one account, several people close to General Petraeus received harassing emails and the messages were traced back to Mrs Broadwell, with whom he is believed to have broken off the affair several months ago.
"It was portrayed to us that the FBI was investigating something else and came upon him," a congressional official briefed on the inquiry told The New York Times. "My impression is that the FBI stumbled upon this."
It is also unclear when the affair began. An unnamed official told The Wall Street Journal that the relationship started after General Petraeus left the army in August 2011. But the two were reported to have been close during his time running the war in Afghanistan when Mrs Broadwell was, in military parlance, an "embedded" journalist with him.
Ronald Kessler, a veteran Washington journalist who has written a book on the FBI and has close contacts at the bureau, said that the investigators found emails from the general's time in Afghanistan apparently detailing sexual encounters, including a tryst under his desk.
General Petraeus is not under investigation for any crime, US officials said, and no breach of national security has been revealed at this stage. But as head of the CIA, he would have known that an affair would jeopardise his career.
The military mastermind who re-wrote US doctrines of counter-insurgency and was proud to be savvy when it came to the media and politics, has been brought down by a shocking lack of judgment.
He was a model and mentor for many up-and-coming officers. But among his fellow top brass, there were those who viewed him as a vaulting careerist who crafted his portrayal in the media for his own personal ambitions.
General Petraeus's success with the military surges earned him rock-star status among his own troops.
It is with sad irony that it was an affair with an adulatory biographer that has sabotaged his ambitions. "General Petraeus is a man obsessed by his own image," a senior officer who knows him well told The Sunday Telegraph in the US. "Sadly this has been his downfall."
His fall from grace leaves Barack Obama searching for a new spy chief days after his re-election. The timing also prompted questions: the CIA director was due to appear before Congress this week to be grilled about how his agency and the White House handled intelligence on the US consulate attack in Benghazi that claimed the lives of four Americans, including the ambassador to Libya.
Geneeral Petraeus, 60, was a career soldier who led the 101st Airborne Division in the 2003 Iraq invasion and commanded the US military "surges" in Iraq and Afghanistan, operations based on his counter-insurgency strategy that focused on protecting civilians as well as killing enemies.
The "surge" in Iraq, under George W Bush, is widely credited with turning around a failed war; the second, under Mr Obama, delivered a major blow to the Taliban.
Following his retirement, the general, who has been married for 37 years and has two adult children, was appointed by Mr Obama last November to head the CIA at a time when some Republicans hoped that the war veteran could be persuaded to run for president. There was speculation this year that Mitt Romney might pick him as a running mate.
Mrs Broadwell, 40, a high achiever in her own right, lives in a large detached brick home valued at nearly $US1 million in an upmarket district of Charlotte, North Carolina, with her husband Scott, an interventional radiologist, and their two young sons, Landon and Lucien.
She is a research associate at Harvard's Centre for Public Leadership and is working on a PhD in the war studies department at King's College London. She has a long list of other academic qualifications from prestigious institutions and previously worked for US Special Operations Command and an FBI joint terrorism task force. According to the biography on her personal website, which was taken down after the scandal broke, she has completed half-triathlons and was a "female model/demonstrator" for a manufacturer of.45-calibre machine guns.
Mrs Broadwell and General Petraeus met in 2006 at Harvard when she was studying for a masters degree at the university's Kennedy School of Government when he gave a class there. After the lecture, she introduced herself and the visiting officer answered her follow-up questions on counterinsurgency and counter-terrorism.
With his help, she moved on to a PhD dissertation entitled "A case study of General Petraeus's leadership".
Two years later, he was appointed by Mr Obama to run the war in Afghanistan after his predecessor, General Stanley McChrystal, was forced to quit following disparaging comments that he and his senior staff made to a Rolling Stone magazine journalist about Obama administration officials. Gen Petraeus noted at the time that there would have been no such naive media slips by his team.
Mrs Broadwell spotted an opportunity to turn her dissertation into a book and negotiated a deal with Penguin Press, bringing in Vernon Loeb, a Washington Post editor, to help. She boasted of her access to her subject in a hagiographical work that some reviewers said amounted to a gushing love letter.
"I took full advantage of his open-door policy to seek insight and share perspectives," she wrote in All In: The Education of General David Petraeus, published in January.
In an interview with Jon Stewart, the US television show host, to promote the book earlier this year, Mrs Broadwell told how from summer 2010 to summer 2011 she spent several months "embedded" - the military term for journalists given official access to the armed forces in a war zone - with General Petraeus in Afghanistan.
During the show, she made clear her starry-eyed fondness for her subject. "He can turn water into bottled water," she joked. She has also said that she viewed him as a mentor and in the book she notes that he saw her as "aspiring soldier-scholar" - a high accolade from a man who regarded himself as the master exponent of that combination. Both were also fitness fanatics. Indeed, she conducted much of her research work during the five-mile morning runs to which Gen Petraeus would invite honoured guests in Iraq and Afghanistan.
"I thought I'd test him, but he was going to test me - it ended up being a test for both of us since we both ran pretty quickly," she told Stewart. "That was the foundation of our relationship." When he didn't want to answer questions, she said, "he would pick up the pace so neither of us could talk".
The revelation of the affair came as little surprise to some who worked with the two in Afghanistan. "As soon as the announcement was made, I knew in an instant who it was," a senior US military source who has worked closely with General Petraeus told the Business Insider website.
"Everything made sense. Who had exclusive access to him? Who wrote the hagiography on his life? Who framed their entire existence around his persona?"
The unnamed source, who claimed to have known Mrs Broadwell for several years and to have briefed her for the book, said: "Over that time, she went from someone very likeable to a shameless, self-promoting prom queen. A very disturbing shift in how she carried herself. If she knew [Gen Petraeus] was going to make an appearance at an event, she'd crash it without an invitation."
General Petraeus graduated top of the class in 1974 from West Point military academy. It was not only the start of a glittering career, he also met his future wife there: Holly Knowlton was the daughter of the general who ran the academy.
Mrs Petraeus runs the wing of the US Consumer Financial Protection Bureau that assists military families financially. The couple's son, Stephen, has followed his father into the military, and their daughter, Anne, is a food writer who was married last month.
In a short statement after his resignation, General Petraeus said: "After being married for over 37 years, I showed extremely poor judgment by engaging in an extramarital affair. Such behaviour is unacceptable, both as a husband and as the leader of an organisation such as ours."
Obama administration officials said that the White House was only informed of the FBI investigation on Wednesday, although former intelligence officials have expressed surprise that the president's team was not alerted earlier.
General Petraeus met Mr Obama in the White House on Thursday to offer his resignation. Fresh back from his gruelling election campaign, the president did not initially want to accept the resignation, but said he would think about it overnight. The next day, he called his CIA director to tell him that he would not pressure him to stay.
"By any measure through his lifetime of service, David Petraeus has made our country safer and stronger," the president said in a statement that did not mention the affair. Mrs Broadwell has made no public comment, but her identity was confirmed to media outlets by several US officials.
General Petraeus's success with the military surges earned him rock-star status among his own troops. His authorship of an influential US counter-insurgency field manual earned him the nickname the "Warrior Monk", and as commander during the 2003 invasion of Iraq, he was known for asking embedded reporters, "Tell me how this ends?".
Many interpreted that as a catchphrase that foresaw the chaos that he would later be called back to Iraq to fix. Few could ever have imagined it having such resonance in his own career.
He regularly shared his wisdom with younger officers to whom he preached a mantra of individual leadership and personal character, reminding them of the need to do the right thing, even when nobody is watching.
Last week Mrs Broadwell shared 12 lessons on leadership from Gen Petraeus in an article for Newsweek. Several take on an added resonance in light of the scandal that erupted a few days later.
Most notable is number five: "We all will make mistakes. The key is to recognise them and admit them, to learn from them." It is a moral that General Petraeus and Mrs Broadwell will doubtless both be considering now as they try to put their lives back together.
Additional reporting by Colin Freeman and Sean Rayment
The Sunday Telegraph, London