WASHINGTON (AP) -- David Petraeus, the retired four-star general who led the U.S. military campaigns in Iraq and Afghanistan, has resigned as director of the CIA after admitting he had an extramarital affair.
The resignation shocked Washington's intelligence and political communities, representing a sudden end to the public career of the best-known general of the post 9/11 wars.
According to a statement he sent to CIA employees, Petraeus asked President Barack Obama on Thursday to allow him to resign and on Friday the president accepted. Petraeus said he had shown "extremely poor judgment" in having the affair.
"Such behavior is unacceptable, both as a husband and as the leader of an organization such as ours," Petraeus said.
Obama said in a statement that the general had provided "extraordinary service to the United States for decades" and had offered a lifetime of service that had "made our country safer and stronger."
The president said that CIA Deputy Director Michael Morell would serve as acting director. "I am completely confident that the CIA will continue to thrive and carry out its essential mission," Obama said.
Petraeus has been married for 37 years to Holly Petraeus, whom he met when he was a cadet at the U.S. Military Academy at West Point.
In his statement, he said to Obama, "Teddy Roosevelt once observed that life's greatest gift is the opportunity to work hard at work worth doing. I will always treasure my opportunity to have done that with you, and I will always regret the circumstances that brought that work with you to an end."
Though Obama made no direct mention of Petraeus' reason for leaving, he offered his thoughts and prayers to the general and his wife, saying that Mrs. Petraeus has "done so much to help military families through her own work. I wish them the very best at this difficult time."
The director of national intelligence, James Clapper, said in a separate statement that 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."
Former CIA officer Bruce Riedel, now with the Brookings Institution, noted that other directors have "resigned under unpleasant and unflattering circumstances."
CIA Director Jim Woolsey left "under embarrassing circumstances over the discovery of a KGB mole, and director John Deutch left after putting some classified information on his home computer," Riedel said
Before Obama brought Petraeus to the CIA, he was credited with salvaging the U.S. war in Iraq.
"His inspirational leadership and his genius were directly responsible - after years of failure - for the success of the surge in Iraq," Sen. John McCain, R-Ariz., said Friday.
President George W. Bush sent Petraeus to Iraq in February 2007, at the peak of sectarian violence, to turn things around as head of U.S. forces. He oversaw an influx of 30,000 U.S. 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 U.S. withdrawal.
After Iraq, Bush made Petraeus commander of U.S. Central Command, overseeing all U.S. military operations in the greater Middle East, including Afghanistan and Pakistan.
When the top U.S. commander in Afghanistan, Gen. 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 U.S. troops to that war and dramatically boost the effort to train Afghan soldiers and police.
House Homeland Security Chairman Peter King, R-N.Y., said he regretted Petraeus' resignation, calling him "one of America's most outstanding and distinguished military leaders and a true American patriot."
Senate Intelligence Committee Chairman Dianne Feinstein also regretted the resignation but gave Morell high marks, too.
"I wish President Obama had not accepted this resignation, but I understand and respect the decision," she said.