WASHINGTON (AP) — President Donald Trump unceremoniously dumped Secretary of State Rex Tillerson on Tuesday — via Twitter — and picked CIA Director Mike Pompeo to shift from America's spy chief to its top diplomat. The abrupt announcement ended the turbulent tenure of the man who reportedly called the president a "moron" but wanted to stay, and deepened the disarray in the Trump administration.

The plans to oust Tillerson had been drawn up months ago, but the timing caught even senior White House officials unawares. The firing was just the latest in an exodus of administration officials, including those in Trump's inner circle, with the president already setting records for staff turnover and several other Cabinet secretaries facing ethics investigations.

However, Trump emphatically rejected talk of chaos in his year-old administration as he nears a pivotal moment on the international stage with his planned meeting with North Korean leader Kim Jong Un. He declared Tuesday, "I'm really at a point where we're getting very close to having the Cabinet and other things that I want."

He said he was nominating the CIA's deputy director, Gina Haspel, to take over for Pompeo at the intelligence agency. If confirmed, Haspel would be the CIA's first female director.

As for Tillerson, the former Exxon Mobil CEO whom Trump picked as his administration's top Cabinet official, the president said simply, "we disagreed on things."

No doubt that was true, one prime example being the agreement to restrict Iran's nuclear efforts. Trump's change puts Pompeo, an ardent foe of the Iran nuclear deal, in charge of U.S. diplomacy as the president decides whether to withdraw the U.S. from the agreement. Tillerson has pushed Trump to remain and had been pursuing a delicate strategy with European allies and others to try to improve or augment the Obama-era deal to Trump's liking.

"We were not really thinking the same," said Trump.

Public policy aside, in the view of current and former White House officials, Tillerson's "moron" comment to senior administration officials last summer — and the subsequent revelation in the press — permanently eroded trust between the two men and it was only a matter of time before Tillerson would be pushed out.

Tillerson himself, his voice occasionally quavering, gave brief farewell remarks at the State Department, thanking department staff and diplomats around the world — but not mentioning Trump except to say that he'd spoken by phone to the president Tuesday while Trump was on Air Force One, hours after the tweeted firing.

The gulf that separated the two men was illustrated one last time by conflicting stories on the circumstances of the firing.

Trump kept the timing to an unusually close circle that included Chief of Staff John Kelly and Vice President Mike Pence, officials said. Pompeo was brought into the White House on Friday after returning from an overseas trip and was offered the job formally by phone Saturday.

Kelly was given the task of phoning Tillerson, who was in Africa, but the nature of their conversation was up for dispute. White House officials said Kelly told Tillerson that Trump wanted a change and he should step down. Tillerson, the White House said, asked that Trump wait until he returned to the U.S., and he shortened his trip to Africa — where much of his mission revolved around softening the impact of Trump's recent reported criticisms.

However, Undersecretary of State Steve Goldstein and other State Department officials said that Tillerson hadn't learned he was being dismissed until he saw Trump's early-Tuesday tweet, and hadn't discussed it directly with the president. Goldstein said Tillerson was "unaware of the reason" he was fired and "had had every intention of staying," feeling he was making progress on national security.

That was the end for Goldstein. Hours later, he was fired, too.

Even after Tuesday's announcement, the White House and Tillerson aides were still struggling to determine when and how Tillerson would exit. After hours of bureaucratic tug-of-war, Tillerson, in his final somber turn before the cameras, said he would be delegating his responsibilities to deputy secretary John Sullivan at the end of the workday and would resign effective at the end of the month.

"I will now return to private life, private citizen, a proud American, proud of the opportunity I've had to serve my country," he said.

From the start, the former Exxon chief had been an unlikely pick for top diplomat, with no formal experience but a lifetime's worth of personal relationships with heads of state and powerful global figures, including Russian President Vladimir Putin. Trump had boasted to allies that he "looked the part" of the nation's chief diplomat, but differences in style and ideology quickly came to a head.

While he espoused unconventional views on the organization of the State Department — and made sweeping reform of the bureaucracy his top concern — Tillerson proved to be cut from the same cloth of the national security conservatives who have dominated the GOP for decades. He had been recommended for the post by Condoleezza Rice and James Baker.

Tillerson's insult to Trump's intelligence came after heated discussions about Afghanistan policy, in which Trump had pushed to end the U.S. presence altogether and flirted with outsourcing the military counterterrorism campaign to private contractors. Hours before his firing was made public, Tillerson vocally condemned Russia for allegedly poisoning an ex-Russian spy and his daughter in the United Kingdom, even as the White House declined to assert blame.

The pair also never developed a particularly warm relationship.

Trump in recent days has told confidants that he feels emboldened, confident in his decisions to order new international trade on tariffs and to meet with Kim Jong Un and far less willing to put up with disloyalty around him, according to a person who has spoken to the president in recent days but was not authorized to publicly discuss private conversations.

Tillerson's departure adds to a period of intense turnover within Trump's administration that has alarmed those both in and out of the White House. Top economic adviser Gary Cohn announced his resignation last week, not long after communications director Hope Hicks and staff secretary Rob Porter both departed near the start of Trump's second year in office.

Trump has also faced a cloud of ethics allegations surrounding other members of his Cabinet, including Interior Secretary Ryan Zinke, EPA Administrator Scott Pruitt, and Veterans Affairs Secretary David Shulkin — the latter of whom is said to be on thin ice with the president.

Pompeo forged a close relationship with Trump as a regular presence in his presidential daily briefing. Current and former White House officials said Pompeo has proven more adept at negotiating the shifting power structures inside the administration and in reading and responding to the wishes of the president. Trump is also said to respect Pompeo's military background and West Point pedigree.

Pompeo, a former Republican congressman from Kansas, has already been confirmed by the Senate for his current role at the CIA, making it extremely likely that he will be confirmed for the State Department role.

___

Associated Press writers Matthew Lee, Jill Colvin, Jonathan Lemire, Lisa Moscaro and Ken Thomas contributed to this report.