NBC News' Andrea Mitchell got her hands on the letter Petraeus sent to staff. Here's the relevant snippet:
"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. This afternoon, the President graciously accepted my resignation."
Sources tell Slate's Fred Kaplan that President Obama, who had been getting along with Petraeus very well in the past couple years, agonized for 24 hours over the letter of resignation before accepting it.
Officials say that President Obama has appointed Mike Morrell, the current deputy director at the agency and a longtime CIA officer, to serve as interim director at the CIA. Multiple sources tell NBC News and other outlets that Morrell is currently the odds-on favorite to replace Petraeus in a more permanent capacity down the line.