WASHINGTON — In the days leading up to President Trump’s decision on whether to launch a missile strike against Iran, Secretary of State Mike Pompeo commanded the stage.

After warning that Mr. Trump was prepared to use force because of Iran’s suspected role in oil tanker attacks, Mr. Pompeo flew to Florida on Monday to strategize with generals at Central Command. Back in Washington, he briefed the foreign minister of the European Union on intelligence. By Thursday, he was pressing the case in the White House Situation Room for a strike.

Mr. Pompeo was steering Mr. Trump toward one of the most consequential actions of the administration. Only at the last minute did the president reverse course and cancel the strike.

The confrontation with Iran has put a spotlight on the extent of Mr. Pompeo’s influence with Mr. Trump. In an administration that churns through cabinet members at a dizzying pace, few have survived as long as Mr. Pompeo — and none have as much stature, a feat he has achieved through an uncanny ability to read the president’s desires and translate them into policy and public messaging. He has also taken advantage of a leadership void at the Defense Department, which has gone nearly six months without a confirmed secretary.