The deputy director of the CIA is leaving the agency and being replaced by a White House lawyer who has never worked at the agency.

“As much as I would selfishly like to keep Michael right where he is for as long as possible, he has decided to retire to spend more time with his family and to pursue other professional opportunities,” CIA Director John Brennan said in a statement announcing Michael Morell’s departure. “In many respects, Michael has come to personify the strengths and qualities of this great organization, and it is difficult for me to imagine CIA without Michael’s exceptionally sharp mind, tremendous energy, and absolute dedication to mission. But I am comforted by the fact that Michael will be able to spend more time with his wonderful family.”

Morell has been at the CIA since 1980 and worked his way up the ranks. He was passed over twice by President Obama for the top job despite running the agency for two gap periods between Obama’s three CIA directors.

Brennan said he was “extremely pleased” that Deputy Assistant to the President and Legal Adviser to the National Security Council Avril Haines will take Morell’s place.

The switch seems sudden because Obama just nominated Haines to another post in mid-April, when he named her to be the next legal adviser to the State Department. Before her White House job, Haines was the State Department’s assistant legal adviser for treaty affairs.

“She has published in the area of private international law and the law of war, has taught classes as an adjunct faculty member at Georgetown University Law School, and has represented the United States in international negotiations at the Hague Conference, the United Nations, and elsewhere,” Brennan said. She hasn’t served at the CIA.

Morell said his last day will be Aug. 9.

“Whenever someone involved in the rough and tumble of Washington decides to move on, there is speculation in various quarters about the ‘real reason.’ But when I say that it is time for my family, nothing could be more real than that,” he said in a statement.

“…From being the PDB briefer at the side of President Bush on that horrific day in September 2001 to being at President Obama’s side as the United States brought Bin Ladin to justice in May 2011—and all the ups and downs in between—few Americans have been as privileged as I have been to work at, and to represent, such an extraordinary organization.”