The sun was rising on the Mediterranean one recent morning when the crew of an Iranian cargo ship heard an explosion. The ship, the Shahr e Kord, was about 50 miles off the coast of Israel, and from the bridge the sailors saw a plume of smoke rising from one of the hundreds of containers stacked on deck.

The state-run Iranian shipping company said the vessel had been heading to Spain and called the explosion a “terrorist act.”

But the attack on the Shahr e Kord this month was just one of the latest salvos in a long-running covert conflict between Israel and Iran. An Israeli official said the attack was retaliation for an Iranian assault on an Israeli cargo ship last month.

Since 2019, Israel has been attacking ships carrying Iranian oil and weapons through the eastern Mediterranean and Red Seas, opening a new maritime front in a regional shadow war that had previously played out by land and in the air.

The Israeli campaign, confirmed by American, Israeli and Iranian officials, has become a linchpin of Israel’s effort to curb Iran’s military influence in the Middle East and stymie Iranian efforts to circumvent American sanctions on its oil industry.

But the conflict’s expansion risks the escalation of what has been a relatively limited tit-for-tat, and it further complicates efforts by the Biden administration to persuade Iran to reintroduce limits on its nuclear program in exchange for sanctions relief.

“This is a full-fledged cold war that risks turning hot with a single mistake,” said Ali Vaez, Iran program director at the International Crisis Group, a Brussels-based research organization. “We’re still in an escalatory spiral that risks getting out of control.”

Since 2019, Israeli commandos have attacked at least 10 ships carrying Iranian cargo, according to an American official and a former senior Israeli official. The real number of targeted ships may be higher than 20, according to an Iranian Oil Ministry official, an adviser to the ministry and an oil trader.

Most of the ships were carrying fuel from Iran to its ally Syria, and two carried military equipment, according to an American official and two senior Israeli officials. An American official and an Israeli official said the Shahr e Kord was carrying military equipment toward Syria.

The Israeli government declined to comment.