CIA Director Mike Pompeo has agreed with President Trump’s positions on the Iran nuclear deal — unlike outgoing Secretary of State Rex Tillerson. (Melina Mara/The Washington Post)

President Trump has chosen a new secretary of state, untested in diplomacy but more attuned to the president’s views and way of conducting foreign policy, at a time when the United States is facing an array of delicate and potentially dangerous national security challenges.

Seeking what he called “a different mind-set, a different thinking,” Trump said Tuesday that he was replacing the reserved and cautious Rex Tillerson with CIA Director Mike Pompeo, a former House of Representatives firebrand with strong “America First” and hard-line Republican credentials.

“With Mike, Mike Pompeo, we have a very similar thought process. I think it’s going to go very well,” Trump said as he left the White House for a trip to California.

Both Tillerson’s departure and the choice of Pompeo had been rumored for months, amid Trump’s clear unhappiness over public disagreements with Tillerson on issues ranging from Russia to the Middle East and North Korea. Although he frequently derided the rumors as “fake news,” Trump said Tuesday that he had been considering replacing Tillerson for “a long time.”

But the reality of the move, and the suddenness with which it was done — with Tillerson returning early from a trip to Africa, only to learn via a Trump tweet early Tuesday that he had been fired — startled and confused allies around the globe and many throughout the government.

In an afternoon appearance before reporters at the State Department, Tillerson’s voice quavered as he vowed to ensure an “orderly and smooth transition” before his formal departure on March 31. He expressed no gratitude or good wishes to Trump, thanked his staff, and commended the strong commitment to diplomacy of Defense Secretary Jim Mattis, who has often served as his ally in battles with the White House.

Tillerson spoke of the importance of “allies and partners” in promoting global security, and he thanked the American people for their “devotion to a free and open society, to acts of kindness towards one another, to honesty.”

Pompeo, whose once-active Twitter account has lain dormant since he was nominated as CIA chief 14 months ago, said in a statement that he was “deeply grateful” to Trump and that he looked “forward to representing him and the American people to the rest of the world to further America’s prosperity.”

Trump also named CIA Deputy Director Gina Haspel to succeed Pompeo as the agency’s director. She would become the first woman to run the spy agency and could come under scrutiny during the Senate confirmation process over her past role in running one of the CIA’s “black site” prisons, where detainees were subjected to interrogation methods widely denounced as torture.

Senate Foreign Relations Committee Chairman Bob Corker (R-Tenn.) said he expected to hold a confirmation hearing for Pompeo in April. The closely divided chamber has stalled on confirming dozens of Trump nominees.

Reaction to the fast-moving events varied widely. Thomas Countryman, one of a number of career diplomats dismissed by Tillerson early in the administration as he gutted staff and supported Trump’s massive budget cuts, called him “a poor advocate for the State Department.”

But Tillerson, he said, “served as a Cabinet-level check on some of President Trump’s worst impulses, such as wanting to ‘break’ the Iran nuclear agreement. . . . If the new secretary of state has a disdain for diplomacy mirroring Trump’s, it will be bad for the department and the country.”

Sen. Lindsey O. Graham (R-S.C.), by contrast, said he “cannot think of a better choice” than Pompeo.

“No one understands the threat posed by North…