"Yesterday afternoon, I went to the White House and asked the President to be allowed, for personal reasons, to resign from my position," Petraeus said in his resignation letter. "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."

"This afternoon, the President graciously accepted my resignation," Petraeus said in the letter.

Mike Morrell, the deputy CIA director and a long time CIA officer, will likely be offered the job as acting director, multiple sources told NBC News.