White House national security adviser John Bolton talked himself out of a job, two cabinet officials suggested shortly after President Trump announced the key adviser’s departure from the administration.

“The president's entitled to the staff that he wants,” Secretary of State Mike Pompeo told reporters Tuesday afternoon. “This is a staff person who works directly for the president of the United States. And, [the president] should have people he trusts and values and whose efforts and judgments benefit him in delivering American foreign policy.”

Pompeo spoke during a press conference about a new plan that “modernizes our counterterrorism sanctions to better combat terrorists,” released a day before the anniversary of the Sept. 11, 2001, terrorist attacks. Bolton was scheduled to appear at the press conference alongside Pompeo and Treasury Secretary Steven Mnuchin. Instead, Pompeo and Mnuchin spent the briefing defending the ouster of Trump’s third national security adviser.

“When the president makes a decision like this, he's well within his rights to do so,” Pompeo said.

Bolton joined the administration last year in the national security team shake-up that saw Pompeo moved from his post as CIA director to replace outgoing Secretary of State Rex Tillerson. The two men were widely perceived as allies in the effort to turn Trump’s hostility to the 2015 Iran nuclear deal into a maximum pressure campaign against the regime in Tehran.

But Bolton’s star declined over the last several months, in part because of his opposition to the Taliban peace talks led by Pompeo’s team. The negotiations put his hawkish foreign policy sensibilities in tension with Trump’s long-standing desire to withdraw U.S. troops from Afghanistan. Other officials reportedly tried to exclude him from meetings about the Taliban talks, while State Department special representative Zalmay Khalilzad even restricted Bolton’s access to a draft agreement of the deal. Neither Pompeo nor Mnuchin would say directly whether the dispute over the Afghanistan policy was the direct cause of Bolton's departure. Mnuchin used the 2003 invasion of Iraq as a stand-in for the subject of Afghanistan.

"The president's view on the Iraq War and ambassador Bolton's was very different," Mnuchin said.

Bolton reportedly opposed Trump’s desire to host a meeting of the Taliban and Afghan President Ashraf Ghani at Camp David, a decision Pompeo supported. Trump revealed the meeting by announcing that it was canceled, after an American soldier was killed by a Taliban suicide bomber on Thursday. The disruption of the peace talks — which Trump declared “dead” Monday afternoon — might have been expected to empower Bolton, but he was down to his last 24 hours in the job.

The departure was messy. Trump portrayed the decision as a firing. But Bolton, a veteran of numerous bureaucratic wars while working for four Republican presidents, quickly countered that he resigned. Pompeo, who affirmed that "the president asked for ambassador Bolton’s resignation," tried to present a picture of stability.

“Someone asked, would the policy be different absent any individual being here? These have been the president's policies,” Pompeo said. "I don't think any leader should make the assumption that, because some one of us departs, that President Trump's foreign policy will change in a material way.”

[Read more: Bolton ouster stuns Congress]