WASHINGTON — By the time President Trump met with congressional leaders on the afternoon of June 20, he had already decided to retaliate against Iran for shooting down an American surveillance drone. But for once, he kept his cards close to the vest, soliciting advice rather than doing all of the talking.

“Why don’t you go after the launch sites?” a Republican lawmaker asked.

“Well,” Mr. Trump replied with a hint, “I think you’ll like the decision.”

But barely three hours later, Mr. Trump had changed his mind. Without consulting his vice president, secretary of state or national security adviser, he reversed himself and, with ships readying missiles and airplanes already in the skies, told the Pentagon to call off the airstrikes with only 10 minutes to go. When Vice President Mike Pence and other officials returned to the White House for what they expected would be a long night of monitoring a military operation, they were stunned to learn the attack was off.

That about-face, so typically impulsive, instinctive and removed from any process, proved a decision point for a president who has often threatened to “totally destroy” enemies but at the same time has promised to extricate the United States from Middle East wars. It revealed a commander in chief more cautious than critics have assumed, yet underscored the limited options in a confrontation he had set in motion.