Only a ceasefire deal in Gaza stemming from hoped-for talks this week would hold Iran back from direct retaliation against Israel for the assassination of Hamas leader Ismail Haniyeh on its soil, three senior Iranian officials said.

Iran has vowed a severe response to Haniyeh’s killing, which took place as he visited Tehran late last month and which it blamed on Israel. Israel has neither confirmed or denied its involvement. The U.S. Navy has deployed warships and a submarine to the Middle East to bolster Israeli defenses.

One of the sources, a senior Iranian security official, said Iran, along with allies such as Hezbollah, would launch a direct attack if the Gaza talks fail or it perceives Israel is dragging out negotiations. The sources did not say how long Iran would allow for talks to progress before responding.

With an increased risk of a broader Middle East war after the killings of Haniyeh and Hezbollah commander Fuad Shukr, Iran has been involved in intense dialogue with Western countries and the United States in recent days on ways to calibrate retaliation, said the sources, who all spoke on condition of anonymity due to the sensitivity of the matter.