08 JUNE 2017 – The suicide bombing and shooting in Tehran is the most surprising and also, in terms of fallout, the most significant of the terrorist attacks which have taken place internationally in the past week. It comes at a time when the Middle East is going through an extraordinary political upheaval, cutting across its traditional sectarian faultlines – and when Donald Trump is conducting a campaign of threats against Iran.

Iran, unlike much of the rest of the Middle East and North Africa, has been relatively free of terrorist attacks. There have been bombings in Ahvaz in the south-west where there is a long-running Sunni Arab secessionist movement, but the last major attacks in cities were seven years ago. Four scientists were assassinated between 2010 and 2012, but these are alleged to have been carried out by Israel in an effort to hinder Iran’s then nascent nuclear programme.

Indeed, the safety offered by Iran is one of its strongest selling points.

Reporting from there on elections this year and last, I came across businessmen from abroad who complained about the problems caused by sanctions still lingering despite 2015 nuclear deal with the West. And the problems caused by Iran’s bureaucracy and red tape. But, at the same time, they stressed the stability offered by election victories of a reformist government and the lack of a major terrorist threat, unusual for the region, made the prospect of investment a bit more attractive.

I also came across a surprisingly large number of foreign tourists taking advantage of Iran opening up to the outside world to visit the fabulous history of places like Isfahan and Shiraz: similar kinds of holidays in Egypt, Turkey and Tunisia are increasingly less of an option because of the violence which has become pervasive in those places.

The attacks on the parliament in Tehran and the tomb of Ayatollah Khomeini, killing 12 people and injuring 45 others, will of course dent that image of security and there will be further damage to confidence if there are more acts of terrorism.

Isis has claimed credit for the assault. If that is true – and one has to bear in mind that the group routinely tries for ownership of terrorist attacks internationally – then it is the first time that it has struck successfully inside Iran.

It would make logical sense for Isis to carry out such an attack. Salafist Sunnis regard Shia Iran as a nation of heretics and legitimate targets. Iran is also fighting against Isis in support of Bashar al-Assad’s regime. And there have also been recent threats issued by Isis against Iran, with the group putting out a video in Persian calling on Iran’s Sunni minority to rise up.

But Iran also has other enemies who would be keen to see the country destabilised. There were bound to be accusations that other players – states which had backed Sunni extremist groups in Syria – were hidden hands behind what happened. Just hours before the murderous attack in Tehran, the Saudi foreign minister, Adel al-Jubeir, had declared that Iran is the world’s leading supporter of terrorism and must be punished. It was thus not surprising that Iran’s Revolutionary Guard has accused Saudi Arabia of being behind the attack, paving the way towards a dangerous confrontation.

The potentially incendiary development comes as the region is going through dramatic twists and turns fracturing its Sunni alliance. Qatar is being isolated at the instigation of Saudi Arabia which has decided that the time has come to slap down its tiny Gulf neighbour which was getting too big for its boots. The official reason given was Qatar’s supposed support of terrorist groups, and, in particular the Muslim Brotherhood, hated by the Saudis, but certainly not considered terrorists by countries such as the UK.

The Saudis and their Bahraini and Emirati allies are also furious with Qatar for being conciliatory towards Iran and maintaining diplomatic relations with their great Shia adversary. One Sunni state, Oman, had taken a more balanced approach to Iran for a while and, indeed, was the place where some of the nuclear talks took place. Kuwait, too, had urged negotiations with Iran to solve the sectarian conflicts in the area. The Saudis, seeing their Sunni satellite states beginning to drift, have now lashed back, with the Qataris made an example of.

Looming over this all this is the shadow of Donald Trump: in his first official tour as President, which was essentially to sell arms to the Saudis and other Gulf states, he repeatedly attacked Iran, accusing it of exporting terrorism, ignoring the fact that almost all terrorist attacks in the West have been carried out by Sunnis inspired by Saudi-based extremist Wahaabi, Salafist creed and not Shias.

The US President’s stance emboldened the Saudis who are now talking of regime change in Qatar. Mr Trump has now stepped in again, inevitably in a series of tweets, ranging in coherence, attacking Qatar. The Pentagon and the State Department are scrambling to mitigate the damage caused by the blundering President. Qatar is the hub for US military operations in Iraq and Syria.

The Iranian government was initially restrained in its reaction to the attack, just as it was to Mr Trump’s threats in Riyadh. But then came the statement by the Revolutionary Guard blaming the Saudis and pointing out that it came soon after Mr Trump’s threats against Iran. It is in the interest of the country’s hardliners, who the Guard support, to exploit the terrorist assault and undermine the President Rouhani’s policy or reform at home and reconciliation abroad. A neighbourhood already violent and volatile, has just got even more dangerous.