President Trump on Thursday tapped National Counterterrorism Center director Joseph Maguire to serve as the acting director of national intelligence amid a shakeup at the agency.

Trump made the announcement on Twitter Thursday evening about an hour after he revealed that Deputy Director of National Intelligence Sue Gordon would be stepping down on Aug. 15 — the same day her boss Dan Coats is also scheduled to leave his post.

“Admiral Maguire has a long and distinguished career in the military, retiring from the U.S. Navy in 2010,” Trump tweeted. “He commanded at every level, including the Naval Special Warfare Command. He has also served as a National Security Fellow at Harvard University. I have no doubt he will do a great job!”

The announcement came after Trump said in a series of tweets that Gordon would leave her post on the same day as Dan Coats, the director of national intelligence.

“Sue Gordon is a great professional with a long and distinguished career. I have gotten to know Sue over the past 2 years and have developed great respect for her,” Trump wrote.

“Sue has announced she will be leaving on August 15, which coincides with the retirement of Dan Coats. A new Acting Director of National Intelligence will be named shortly,” he added in a second post.

Trump announced in late July that Coats would step down on Aug. 15. At the time, he said he’d tap GOP Rep. John Ratcliffe for the job, but later reversed course and blamed the media.

“Our great Republican Congressman John Ratcliffe is being treated very unfairly by the LameStream Media,” Trump wrote. “Rather than going through months of slander and libel, I explained to John how miserable it would be for him and his family to deal with these people. John has therefore decided to stay in Congress where he has done such an outstanding job representing the people of Texas, and our Country.”

Gordon’s resignation comes as several reports last week said Trump planned to block her elevation to Coats’s former job. Under federal law, if the director of national intelligence post becomes vacant, the deputy director will take the reins of the agency.

The New York Times last week reported that Gordon planned to resign if Trump tapped someone else to be director of national intelligence when Coats stepped down.