President Trump has told aides that he would consider ending the ceasefire with Iran if Tehran kills American troops, according to U.S. officials cited by the Wall Street Journal, insisting that the weekslong pause in airstrikes remains intact despite a steady stream of violent skirmishes. The president’s reluctance to reignite the war suggested he might be willing to withstand smaller flare-ups for weeks or even months to avoid a broader Middle East conflict, the officials said.

The U.S. and Iran this week engaged in some of the most intense fighting yet since a ceasefire went into effect in early April. Iran fired missiles and drones at regional U.S. bases and Kuwait’s international airport, leaving one person dead, according to U.S. officials. The fight over control of the Strait of Hormuz has caused massive disruptions in global energy markets and international shipping, with Tehran restricting the free flow of trade through the strategic waterway and the U.S. maintaining a strict blockade to and from Iran’s ports.

Secretary of State Marco Rubio described the tit-for-tat attacks as purely defensive in nature and not a renewed outbreak of full-scale war. “They are happening in response to an Iranian action,” Rubio said in a House hearing Wednesday. “If they don’t shoot at those ships, we don’t shoot, but we have to respond.”

U.S. officials said the repeated attacks have ratcheted up pressure on Trump and cast doubt over the long-term viability of the ceasefire. The president has said repeatedly that he is on the verge of signing an end-of-war agreement that would reopen the strait, dismantle Iran’s nuclear work, and eliminate its stockpile of enriched uranium. But in a New York Post interview published Wednesday, Trump said it was unlikely — though still possible — that the U.S. blockade could last until Labor Day.

“In that part of the world, ceasefire is when you’re shooting in a more moderate manner,” Trump told reporters in the Oval Office on Wednesday. He said the current situation was under control and peace talks with Iran were advancing. “It takes two to tango. We hit them very hard on something else and so they were responding,” he said.

For several weeks, Trump and his team have been working on a “memorandum of understanding” with Iran that would define the issues for negotiations over roughly 60 days. Trump rejected Iran’s latest proposal last Friday, telling aides that Iran needed to make serious concessions up front, not over an extended period. Tehran should not receive any benefits until it had done so, Trump told aides, according to the Journal.

Iran has said it would negotiate its nuclear program only after the U.S. unfreezes its assets or provides some other financial windfall. Iranian Foreign Minister Abbas Araghchi said Wednesday that Israeli attacks on Beirut would lead to a return to all-out war, linking the fate of that conflict with the future of the U.S.-Iran ceasefire.

Trump also pressed Israeli Prime Minister Benjamin Netanyahu to call off a planned military offensive in Lebanon after it threatened diplomatic progress. Netanyahu told CNBC on Wednesday that Israel shares Trump’s goal of disarming Hezbollah and demilitarizing Lebanon. Fighting between Israel and Hezbollah continued Wednesday, with the U.S.-designated terrorist group firing rockets into Israel while Israeli attacks hit near the Lebanese capital.

Analysts said the start-stop negotiations have left Trump in a difficult position. “He does seem stuck,” said Steven Cook, a senior fellow for the Middle East at the Council on Foreign Relations. “The Iranians are demonstrating that they are willing to endure pain and thus haven’t capitulated. That leaves the president in a bad situation.”

Suzanne Maloney, an Iran expert and vice president for foreign policy studies at the Brookings Institution, said the conflict appears to be the first mess created by the administration’s preference for hard-power, high-stakes gambits that the president cannot easily ignore or extricate himself from.

A senior U.S. official told reporters that a framework deal would end the war by reopening the Strait of Hormuz and unwinding the U.S. blockade, with Iran pledging to dispose of its highly enriched uranium without saying when or how, and no immediate Iranian pledge to suspend enrichment for years. Trump’s alternative is to accept that the war cannot be wrapped up quickly and that economic pressure on Iran will eventually become impossible to manage, even if that takes months. So far, according to the Journal, Trump has avoided making a choice, flipping between threatening further military escalation and claiming a deal is nearly complete.

Going deeper: Read MSI’s analysis of U.S.-Iran ceasefire sequencing dynamics →