WASHINGTON — Secretary of State Mike Pompeo’s accusation on Thursday that Iran was behind an attack on two oil tankers forces President Trump to confront a choice he has avoided until now: whether to make good on his threat that Tehran would “suffer greatly” if American interests were imperiled.

For weeks, Mr. Trump has weaved on the issue, by turns ordering a carrier group last month to head to the Persian Gulf and then distancing himself from the hawkish views of his national security adviser, John R. Bolton. Last week, the president said he was open to negotiating with Iranian leaders the way he has negotiated with North Korea. And on Thursday, with images of black smoke rising from a tanker hit with a mine, Mr. Trump seemed to reverse course, posting on Twitter that “it is too soon to even think about making a deal,” adding, “They are not ready, and neither are we!”

His equivocation reflects divisions in his administration, which has never come to an agreement on a comprehensive strategy to deal with Iran — especially after it shattered the unity of the United States’ key allies, who had joined with the Obama administration to force Tehran into the 2015 nuclear deal that Mr. Trump subsequently abandoned.

Now, operating largely without allies, he faces an Iran that is escalating nuclear production and retaliating for sanctions the White House has reimposed without a diplomatic path in sight to steer the two longtime adversaries away from confrontation.