David Petraeus, the retired four-star general renowned for taking charge of the military campaigns in Iraq and then Afghanistan, has abruptly resigned as director of the CIA, admitting to an extramarital affair.
The affair was discovered during an FBI investigation, according to officials briefed on the developments.
They spoke on condition of anonymity because they were not authorised to publicly discuss the matter. It was unclear what the FBI was investigating or when it became aware of the affair.
Petraeus' resignation shocked US intelligence and political communities. It was a sudden end to the public career of the best-known general of the post-9/11 wars, a man credited with salvaging the US conflict in Iraq and sometimes mentioned as a potential Republican presidential candidate.
His service was effusively praised on Friday in statements from both Republican and Democratic lawmakers.
Petraeus, who turned 60 on Wednesday, told CIA employees in a statement that he had met President Barack Obama at the White House on Thursday and asked to be allowed to resign. On Friday, Obama accepted.
'Extremely poor judgement'
Petraeus told his staffers he was guilty of "extremely poor judgment" in the affair.
"Such behaviour is unacceptable, both as a husband and as the leader of an organisation such as ours."
He has been married for 38 years to Holly Petraeus, whom he met when he was a cadet at the US Military Academy at West Point, New York. She was the daughter of the academy superintendent. They have two children, and their son led an infantry platoon in Afghanistan.
Obama said in a statement that Petraeus had provided "extraordinary service to the United States for decades" and had given a lifetime of service that "made our country safer and stronger". He called Petraeus "one of the outstanding general officers of his generation".
Michael Morell, CIA's deputy director, will serve as acting director. Morell was the important CIA aide in the White House to President George Bush during the September 11, 2001, terrorist attacks.
"I am completely confident that the CIA will continue to thrive and carry out its essential mission," Obama said.
The resignation comes at a sensitive time. The administration and the CIA have struggled to defend security and intelligence lapses before the attack that killed the US ambassador to Libya and three others.
It was an issue during the presidential campaign that ended with Obama's re-election on Tuesday.
The CIA has come under intense scrutiny for providing the White House and other administration officials with talking points that led them to say the Benghazi attack was a result of a film protest, not a terrorist attack.
It has become clear that the CIA was aware the attack was distinct from the film protests roiling across other parts of the Muslim world.
Morell rather than Petraeus now is expected to testify at closed congressional briefings next week on the September 11 attacks on the consulate in Benghazi.
Petraeus, who became CIA director in September 2011, was known as a shrewd thinker and hard-charging competitor.
His management style was recently lauded in a Newsweek article by Paula Broadwell, co-author of the biography, All In: The Education of General David Petraeus.
The article listed Petraeus' "rules for living". No 5 was: "We all make mistakes. The key is to recognise them, to learn from them, and to take off the rear view mirrors - drive on and avoid making them again."
NBC News reported on its website on Friday, quoting US law-enforcement officials, that Broadwell was under FBI investigation for improperly trying to access Petraeus' email and possibly gaining access to classified information,
Broadwell 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.
Petraeus told his CIA employees that he treasured his work with them "and I will always regret the circumstances that brought that work with you to an end".
The director of national intelligence, James Clapper, said Petraeus' departure represented "the loss of one of our nation's most respected public servants. From his long, illustrious army career to his leadership at the helm of CIA, Dave has redefined what it means to serve and sacrifice for one's country".
Peak of Iraq violence
Bush sent Petraeus to Iraq in February 2007, at the peak of sectarian violence, to turn things around as head of US forces.
He oversaw an influx of 30,000 US troops and moved troops out of big bases so they could work more closely with Iraqi forces scattered throughout Baghdad. Petraeus' success was credited with paving the way for the eventual US withdrawal.
After Iraq, Bush made Petraeus commander of US Central Command, overseeing all US military operations in the greater Middle East, including Afghanistan and Pakistan.
When the top US commander in Afghanistan, General Stanley McChrystal, was relieved of duty in June 2010 for comments in a magazine story, Obama asked Petraeus to take over in Kabul and the general quickly agreed.
In the months that followed, Petraeus helped lead the push to add more US troops to that war and dramatically boost the effort to train Afghan soldiers and police.