CIA Director David Petraeus has resigned because of an extramarital affair.
Petraeus announced the decision in a letter to President Obama released Friday after telling the president the news on Thursday.
“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,” he wrote.
Petraeus's wife, Holly, works at the Consumer Financial Protection Bureau set up by the Wall Street reform bill.
The shocking news could end a sparkling Washington career for Petraeus, who has been mentioned as a presidential candidate. Affairs can end any political career, but are particularly unacceptable for the nation’s top spy given national security implications.
Prior to his tenure at the agency, Petraeus was the top commander of all U.S. forces in Afghanistan. He took the job after former Gen. Stanley McChrystal was forced to resign by the White House over disparaging remarks about the administration.
During his time at CIA, Petraeus oversaw the administration's aggressive counterterrorism campaign, focusing on the increased use of armed unmanned drones in Pakistan, Yemen, Afghanistan and elsewhere.
His resignation comes just three days after Obama was reelected to another four years in office, and amid questions from Republicans about an attack on the U.S. consulate in Libya where four Americans were killed, including the U.S. ambassador to that country and two contractors working for the CIA.
"As I depart Langley, I want you to know that it has been the greatest of privileges to have served with you," the outgoing CIA chief wrote. "Indeed, you did extraordinary work on a host of critical missions during my time as director, and I am deeply grateful to you for that."
The Associated Press reported that the affair was discovered by the FBI as part of an investigation into Petraeus. The report said it was unclear what the FBI was investigating.
As a top commander in the Army, Petraeus is credited as one of the architects of the military's counterinsurgency strategy, which became the crux of the American strategy in Iraq and Afghanistan.
In a statement, Obama commended Petraeus for extraordinary service to his country for decades.
"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," Obama wrote. "As Director of the Central Intelligence Agency, he has continued to serve with characteristic intellectual rigor, dedication, and patriotism."
Top national security lawmakers also expressed praise for the former four-star general, with one top Senate Democrat saying the White House should have not accepted Petraeus's resignation.
Deputy CIA chief Mike Morell is expected to replace Petraeus as the top official in the agency, according to recent news reports. He will also replace Petraeus at a hearing on the Benghazi attack next week.
Rep. Jason ChaffetzJason ChaffetzCongress should investigate cancer collusion Juan Williams: Ethics cloud hangs over Trump Chaffetz says he's 'pleased' Clinton is not president shortly after handshake MORE, a member of the House Oversight Committee, said late Friday that Petraeus should “absolutely” testify about the Benghazi attack.
Speaking on Fox News Channel’s “Hannity” show, the Utah Republican raised questions about the timing of the abrupt departure and the FBI investigation.
“How long did they sit on that information?” he asked.
Obama said he was confident the CIA would thrive and that he had the "utmost confidence" in Morell, who will be the agency's acting director.
"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 said.
--This story was originally published at 3:19 p.m. and last updated at 9:21 p.m.