Updated

CIA Deputy Director Michael Morell resigned from his post Wednesday, after managing the resignation of former CIA Director David Petraeus over an extramarital affair, and defending the agency's performance over the attack on a U.S. diplomatic post in Benghazi, Libya.

Morell was passed over for the top CIA spot by President Obama in favor of his counterterrorism adviser, John Brennan, who announced Morell's departure Wednesday.

Brennan said Morell will be replaced by Avril Haines, currently a deputy assistant to the president and legal adviser at the National Security Council.

Morell agreed to the State Department's request to remove a reference to militants in a controversial memo of talking points about the Libya attack.

Dozens of emails that the White House released a month ago show Morell’s involvement in circulating the revised points. In one email, he noted the State Department had "deep concerns" about referencing prior "warnings."

A page of hand-written notes showed Morell scratching out mentions of Al Qaeda, the experience of fighters in Libya, Islamic extremists and a warning to the U.S. Embassy in Cairo on the eve of the attacks of calls for a demonstration. Ultimately, all of that was scrubbed from the talking points. The final version said "extremists" participated, without mentioning prior attacks and warnings in the region.

Petraeus specifically complained about the removal of the line about the warning to Cairo.

Senior administration officials told reporters that Morell made the changes to the talking points because of his own concerns that they could prejudge an FBI investigation into who was responsible for the Sept. 11, 2012, attack that killed U.S. Ambassador Chris Stevens and three other Americans.

Morell also drew criticism for stating that the CIA's interrogation program produced some useful information.