CIA Director David Petraeus is resigning over an extramarital affair, according to a letter submitted to CIA staff.

Press Secretary Jay Carney confirmed the news in a White House press briefing Friday afternoon.

Mike Morell, the deputy CIA director and a long time CIA officer, is the new acting director the CIA. Politico is reporting that he will testify next week in Senate Intelligence Committee hearings on the Sept. 11 attacks on the U.S. embassy in Benghazi, Libya.

Because of the extramarital affair, Petraeus put national security at risk, essentially forcing his hand to resign.

Here's the full letter, via CNN:

"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.

As I depart Langley, I want you to know that it has been the greatest of privileges to have served with you, the officers of our Nation’s Silent Service, a work force that is truly exceptional in every regard. 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.

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.

Thank you for your extraordinary service to our country, and best wishes for continued success in the important endeavors that lie ahead for our country and our Agency."

The White House sent out a statement from Obama on Petraeus' resignation:

David Petraeus has provided extraordinary service to the United States 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. As Director of the Central Intelligence Agency, he has continued to serve with characteristic intellectual rigor, dedication, and patriotism. By any measure, through his lifetime of service David Petraeus has made our country safer and stronger.

Today, I accepted his resignation as Director of the Central Intelligence Agency. 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. 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.

UPDATE (5:34 p.m. ET): Slate's Fred Kaplan is reporting that Petraeus had an affair with Paula Broadwell. She wrote his biography, "All In: The Education of General David Petraeus," which was released in January."

From Kaplan:

It had long been rumored that something was going on between Petraeus and Broadwell. Her book, co-written with Vernon Loeb, is widely regarded as a valentine to the general. When she was embedded with him in Afghanistan, they went on frequent five-mile runs together. But Petraeus went on five-mile runs with many reporters, and few people who knew him took the rumors seriously. In his personal life, he’s always been seen as a straight shooter, a square. Few could have imagined that his end would come as the result of a morals scandal.

Why Petraeus had to resign >