Over the years, state-backed Iranian hackers have showed both the proclivity and skill to pull off destructive cyberattacks. After the United States tightened economic sanctions against Tehran in 2012, state-supported Iranian hackers retaliated by disabling the websites of nearly every major American bank with what is known as a denial-of-service attack. The attacks prevented hundreds of thousands of customers from accessing their bank accounts.

Those assaults, on about 46 American banks, detailed in a 2016 federal indictment, were directly attributed to Iranian hackers.

Iranian hackers were also behind a digital assault on the Las Vegas Sands Corporation in 2014 that brought casino operations to a halt, wiped Sands data and replaced its websites with a photograph of Sheldon G. Adelson, the Sands’ majority owner, with Prime Minister Benjamin Netanyahu of Israel, according to the indictment.

Security researchers believe the attacks were retaliation for public comments Mr. Adelson made in a 2013 speech, when he said that the United States should strike Iran with nuclear weapons to force Tehran to abandon its nuclear program.

But after the nuclear deal with Iran was signed, Iran’s destructive attacks on American targets cooled off. Instead, its hackers resorted to traditional cyberespionage and intellectual property theft, according to another indictment of Iranian hackers filed in March, and reserved their louder, more disruptive attacks for targets in the Middle East.

With the nuclear deal at risk, American and Israeli officials now worry Iran’s hackers could retaliate with cyberattacks of a more vicious kind. The Israeli war game sessions have included what could happen if the United States and Russia were drawn into cyberwarfare between Israel and Iran, according to a person familiar with the sessions but who was not allowed to speak about them publicly.