Every Israeli prime minister – not least Benjamin Netanyahu – understands that a military entanglement with Hezbollah, Lebanon’s armed Shia movement on Israel’s northern border, is a dangerous wager, especially during an election campaign.

It was Shimon Peres who lost to Mr Netanyahu in 1996, weeks after the former prime minister had incensed Israel’s Palestinian minority – a fifth of the population – by savagely attacking Lebanon in a futile bid to improve his military standing.

Lebanon proved a quagmire for Ehud Olmert too, after he launched a war in 2006 that demonstrated how exposed Israel’s northern communities were to Hezbollah’s rockets. The fallout helped pave Mr Netanyahu’s path to victory and his second term as prime minister three years later.

Mr Netanyahu has faced off with Hezbollah leader Hassan Nasrallah for the full 13 years he has been in power. But unlike his political rivals, he has preferred to play a cautious hand with his Lebanese opponent.

Which makes a recent spate of drone attacks and airstrikes by Israel across the region, including in Lebanon, all the more surprising, even in the context of a highly contested election due to take place next Tuesday. During the campaign, Mr Netanyahu has been buffeted by yet more corruption allegations.

According to Israeli media, two drones dispatched over Beirut late last month were intended to destroy Iranian-supplied equipment that would allow Hezbollah to manufacture precision-guided missiles.

It was the first such Israeli attack on Lebanese soil since a ceasefire ended the 2006 war. Hezbollah and Israel have preferred to flex their muscles in neighbouring Syria, weakened after more than eight years of war.

The attack outraged Lebanon’s leaders, with Mr Nasrallah warning that Hezbollah would shoot down any Israeli drones encroaching on Lebanese airspace. He also vowed revenge, which finally came a week ago when Hezbollah fired at an Israeli military vehicle carrying five soldiers close to the border. Israel said there were no casualties. That was followed by Hezbollah shooting down an Israeli drone in southern Lebanon earlier today. The Israeli army confirmed it had been on a "routine mission" when it fell in Lebanese territory.

In retaliation for last week's attack, Israel shelled Hezbollah positions, a clash Israeli media described as being a “hair’s breadth” from escalating into all-out war.

Neither Israel nor Hezbollah appear to want such an outcome. Both understand the likely heavy toll in casualties and the damaging political consequences.

Nonetheless, Mr Netanyahu appears to be stoking a fire he might ultimately struggle to control – and not just in Lebanon. Around the time of the Beirut attack, Israeli drones were also in action in Iraq and Syria.

Israel appears to be targeting the two ends of the supply chain, from deliveries dispatched in Iraq to their receipt in Lebanon. In the words of Mr Netanyahu, Iran 'is not immune anywhere'

First, Israel hit a building near Damascus, killing two Hezbollah operatives. According to Israel, they were working with Iranian forces to prepare a drone attack on the Golan Heights, the contested Syrian territory annexed by Israel in violation of international law. Then a day later, more Israeli drones – apparently launched from Azerbaijan – targeted depots housing Iranian weapons close to the Iraqi-Syrian border.

There have been reports of half a dozen such attacks since mid-July. They are the first known Israeli strikes on Iraq’s territory in four decades.

The running thread in these various incidents – apart from Israel’s violation of each country’s sovereignty – is Iran.

Until recently, Israel had launched regular forays deep into Syrian airspace to target what it said was the transport through Syria of long-range precision missiles supplied by Iran to Hezbollah, its Shia ally in Lebanon.

Hezbollah and Iran view this growing stockpile of precision weapons – capable of hitting key military installations in Israel – as a vital restraint on Israel’s freedom to attack its neighbours.

Over the past year, Israel’s ability to hit missile convoys as they pass through Syria has narrowed as Bashar Al Assad has regained control of Syrian territory and installed more sophisticated, Russian-made air defences.

Now Israel appears to be targeting the two ends of the supply chain, from deliveries dispatched in Iraq to their receipt in Lebanon. In the words of Mr Netanyahu, Iran “is not immune anywhere”.

The US has not taken kindly to Israel’s actions in Iraq, fearing that a local backlash could endanger the 5,000 troops it has stationed there and push Iraq further into Iran’s arms. In response, the Pentagon issued a statement condemning “actions by external actors inciting violence in Iraq”.

So what is Mr Netanyahu up to? Why risk provoking a dangerous clash with Hezbollah and alienating his strongest asset, a supportive US administration headed by Donald Trump, at this critical moment in the election campaign?

The answer could be that he feels he has little choice.

The same weekend that Israel launched its wave of attacks across the region, French President Emmanuel Macron engineered an unexpected visit by Iran’s foreign minister, Mohammad Javad Zarif, to the G7 summit in Biarritz.

It was part of efforts by Mr Macron, and Europe more generally, to encourage Mr Trump to repair relations with Tehran after the US pulled out of the 2015 nuclear agreement last year and reimposed sanctions. Mr Netanyahu has taken partial credit for the administration’s tough stance.

Now he has been jolted by Mr Trump’s apparent willingness to reconsider, possibly to protect shipping lanes and oil supplies in the Gulf from Iranian disruption, just as the US president seeks re-election.

If Mr Trump indicates a readiness for rapprochement with Iran before polling day, Mr Netanyahu’s narrative is sunk

Any U-turn would conflict sharply with Mr Netanyahu’s agenda. Domestically he has long presented Iran as the ultimate bogeyman, hellbent on gaining a nuclear bomb to destroy Israel. His strongman image has been built on his supposed triumph both in reining in Tehran and recruiting the Trump administration to his cause.If Mr Trump indicates a readiness for rapprochement with Iran before polling day, Mr Netanyahu’s narrative is sunk – and the corruption allegations he faces are likely to take a stronger hold on the public imagination.

That was why, as he headed to London last Thursday, Mr Netanyahu issued a barely veiled rebuke to Mr Trump: “This is not the time to talk to Iran.”

It might also be why a report in the New York Times last week suggested that Israel is contemplating a risky, go-it-alone strike on Iran, something Mr Netanyahu has reportedly been mulling for several years.

Certainly, he has every interest in using attacks like the recent ones to provoke a reaction from Iran in the hope of pre-empting any US overture.

It is a high-stakes gamble and one that risks setting off a conflagration should Mr Netanyahu overplay his hand. These are desperate times for Israel’s longest-serving but increasingly embattled prime minister.

Jonathan Cook is a freelance journalist in Nazareth