David Petraeus, the Princeton-educated four-star US army general credited with turning around the Iraq war, had a career so stellar he once seemed on course for the US presidency.
Petraeus took over as head of the Central Intelligence Agency in September 2011 after both commanding US troops in Iraq and then later heading military operations in Afghanistan.
On Friday, he resigned as head of the CIA, citing an extramarital affair. The woman with whom Petraeus involved was not identified.
As the US political campaign season heated up in 2012 there was talk of the 60-year-old war hero running for president - presumably as a Republican - though the ex-general did not often talk about his party affiliation.
In August, the White House was forced to deny a report that President Barack Obama feared that Republican Mitt Romney wanted Petraeus as his running mate.
Petraeus has himself repeatedly said he has no ambitions to pursue elected office, but he was nevertheless seen as highly adept at manoeuvring through Washington's power politics.
"I am not a politician, and I will never be, and I say that with absolute conviction," Petraeus said on NBC's Meet the Press in August 2010.
Petraeus was revered by some as a hero, credited by his supporters for arresting Iraq's slide into all-out civil war in 2007 and salvaging a US mission that appeared headed for collapse.
Petraeus tried a similar approach to counterinsurgency in Afghanistan, backed up by a build-up of some 30,000 American troops, and after nearly a year as commander there he claimed progress against the Taliban.
But history's verdict on his legacy in Afghanistan remains uncertain, with the Kabul government tainted by corruption and the Taliban increasingly active as the US prepares to withdraw most of its troops by 2014.
Petraeus kept a lower profile as spy chief but during his tenure the CIA provided "policy makers decision advantage through the best possible intelligence", James Clapper, director of National Intelligence, said.
That tenure, however, was also tainted by the bitter fight still raging over who is to blame for the security breakdown at the US consulate in Benghazi on September 11.
US news media suggested that the CIA's fixation with secrecy may have led to confusion over security at the compound and crossed signals with the state department.
According to the Wall Street Journal, the US Benghazi mission was essentially a CIA operation instead of a diplomatic post, and most staff worked for the spy agency.
Christopher Stevens, the US ambassador, and three other Americans were killed when the compound was attacked.
When he was nominated, some former CIA officials and analysts had described Petraeus as a perfect fit for the spy agency, citing his work with intelligence operatives battling al-Qaeda in Iraq, Afghanistan and elsewhere.
The paratrooper, who rewrote the army's manual for counterinsurgency warfare, is a keen athlete who twice escaped death, once when he was shot accidentally during training and then during a parachute jump which went wrong.
No US general since William Westmoreland during the Vietnam War has been so influential or so prominent.
Top of his class
The son of a Dutch sea captain, Petraeus has long been a star in the military.
Intensely competitive, he graduated from the US Military Academy at West Point in 1974, was the top of his 1983 class at the US Army Command and General Staff College, and went on to earn a doctorate in international relations.
He commanded the 101st Airborne Division during the 2003 invasion of Iraq, and quickly secured the northern region around Mosul.
Petraeus later headed the troubled US effort to train Iraqi security forces, and then returned to the Army Command and General Staff College at Fort Leavenworth, Kansas, to oversee the new counterinsurgency manual.
It was from that position that then President George Bush tapped Petraeus to lead the faltering campaign in Iraq in January 2007.
His televised appearances before a restive congress during his Iraq stint made for dramatic scenes, with Petraeus keeping his cool during tense exchanges with war critics.
Obama will now have to choose a new CIA head to nominate to the US senate for approval.
NBC News reported on its website on Friday, quoting US law-enforcement officials, that Paula Broadwell, Petraeus biographer, was under FBI investigation for improperly trying to access his email and possibly gaining access to classified information,
Broadwell, the author of All In: The Education of General David Petraeus, had extensive access to Petraeus in Afghanistan and has given numerous television interviews speaking about him, the report said.
Broadwell could not be reached for comment, NBC News said.