By the CNN Wire Staff
(CNN) — David Petraeus stepped down as the director of the CIA on Friday, saying he had an affair.
“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 in a letter to colleagues.
“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,” Petraeus said.
The retired four-star general had a distinguished 37-year career in the military, helping turn the tide against insurgents while commanding forces in Iraq and Afghanistan.
Petraeus, 60, has been praised by both sides of the political aisle. He took the helm of the CIA in September 2011.
His sudden resignation came as a surprise, just days after President Barack Obama won a second term.
“By any measure, he was one of the outstanding general officers of his generation, helping our military adapt to new challenges, and leading our men and women in uniform through a remarkable period of service in Iraq and Afghanistan, where he helped our nation put those wars on a path to a responsible end,” the president said about Petraeus.
“As director of the Central Intelligence Agency, he has continued to serve with characteristic intellectual rigor, dedication and patriotism.”
Obama accepted Petraeus’ resignation during a phone call Friday, according to a senior administration official.
The two men met Thursday. During that meeting, Petraeus offered his resignation to the president and explained the circumstances behind it, the official said.
Obama expressed confidence that the CIA will continue to move forward, under the direction of Acting Director Michael Morell.
Morrell, a career agency officer, was sworn in as deputy director of the CIA in May 2010. He previously served as associate deputy director and director for intelligence.
Morrell graduated from the University of Akron in 1980 with a Bachelor Degree in Economics.
Director of National Intelligence James Clapper confirmed that Petraeus had turned in his resignation, saying his “decision to step down represents the loss of one of our nation’s most respected public servants.”
Rep. Peter King, chairman of the House Committee on Homeland Security, praised Petraeus as a “true American patriot.”
Petraeus and his wife, Holly, live in Virginia. They have two grown children.
CNN’s Suzanne Kelly and Jill Dougherty contributed to this report.