CIA Director David Petraeus resigned his post on Friday, confessing to having shown "extremely poor judgment by engaging in an extramarital affair." The former Army general rocketed to global prominence as the man in charge of the "surge" in Iraq and later the commander of American forces in Afghanistan.

President Barack Obama said Petraeus had led the Central Intelligence Agency "with characteristic intellectual rigor, dedication and patriotism."

"I am completely confident that the CIA will continue to thrive and carry out its essential mission, and I have the utmost confidence in Acting Director Michael Morell and the men and women of the CIA who work every day to keep our nation safe," the president said in a written statement.

"Going forward, my thoughts and prayers are with Dave and Holly Petraeus, who has done so much to help military families through her own work. I wish them the very best at this difficult time," Obama continued.

Director of National Intelligence James Clapper issued a statement that did not specify a reason for Petraeus' departure but praised his colleague extensively.

"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," said Clapper.

Petraeus went to work as CIA chief in September 2011 after heading up the war in Afghanistan. He had drawn fire in the aftermath of the Sept. 11 attack on the American compound in Benghazi, Libya. His departure comes barely a week before he was scheduled to testify about the assault in closed-door sessions with the intelligence committees of the Senate and House of Representatives. Morell was expected to take his place, congressional aides said.

Petraeus' resignation letter, quoted by several news outlets, centered on his personal behavior.

"Yesterday afternoon, I went to the White House and asked the President to be allowed, for personal reasons, to resign from my position as D/CIA. After being married for over 37 years, I showed extremely poor judgment by engaging in an extramarital affair. Such behavior is unacceptable, both as a husband and as the leader of an organization such as ours," he said. "This afternoon, the President graciously accepted my resignation."

Story continues

Petraeus, 60, has been described as the father of the military's counterinsurgency doctrine. The charismatic officer had been cited as a possible future presidential or vice presidential prospect.

His wife, Holly, has worked inside the Obama administration, serving at the Consumer Financial Protection Bureau.

Arizona Sen. John McCain, the ranking Republican on the Senate Armed Services Committee and one of Petraeus' most outspoken admirers, said the general "will stand in the ranks of America's greatest military heroes."

"His inspirational leadership and his genius were directly responsible—after years of failure—for the success of the surge in Iraq," McCain said in a statement. "Our thoughts and prayers are with him and his family."

In a statement, Senate Intelligence Committee Chairwoman Dianne Feinstein, a Democrat, said, "I very much regret the resignation of David Petraeus. This is an enormous loss for our nation's intelligence community and for our country.

"I wish President Obama had not accepted this resignation, but I understand and respect the decision," Feinstein added.