“It’s very easy to attack, but if you ask Lindsey, ask him how did going into the Middle East, how did that work out? And how did going into Iraq work out?” Mr. Trump told reporters, referring to Senator Lindsey Graham of South Carolina, a Republican ally who warned against showing “weakness” toward Iran. “So we have a disagreement on that. And you know, there’s plenty of time to do some dastardly things. It’s very easy to start.”

Mr. Trump’s team has developed a range of alternatives short of a retaliatory strike with bombs or missiles, including a new round of sanctions to further strangle Iran’s economy, the deployment of more American forces to the region as a deterrent against future provocations and a stepped-up cybercampaign to send a message of resolve to Tehran without bloodshed, officials said.

The president, who was wrapping up a three-day campaign trip to New Mexico and California, began Wednesday by vowing more sanctions on Iran to be detailed in the next 48 hours. Secretary of State Mike Pompeo arrived in Saudi Arabia and declared the attacks an “act of war” by Iran but talked mainly of rallying allies to enhance deterrence.

“That’s my mission here, is to work with our partners in the region,” Mr. Pompeo told reporters on his plane. “We will be working with our European partners as well,” he continued, adding, “We’re working to build out a coalition to develop a plan to deter them.”

The military options available to Mr. Trump are similar to the airstrikes that he called off at the last minute in June after Iran shot down an American surveillance drone. Among those potential Iranian targets were facilities like radar and missile batteries. Instead of missile attacks, the United States later mounted a cyberattack on Iran that avoided the casualties that Mr. Trump said concerned him.