Tehran embassy storming
Flames rise from Saudi Arabia's embassy during a demonstration in Tehran on 2 January 2016. Iranian protesters stormed the Saudi Embassy in Tehran early on Sunday morning as Shi'ite Muslim Iran reacted with fury to Saudi Arabia's execution of a prominent Shi'ite cleric. REUTERS/TIMA/Mehdi Ghasemi/ISNA

The breakdown in relations between Saudi Arabia and Iran may have been inflamed with the execution of Shia cleric Nimr al-Nimr, but Sunni Riyadh and Shia Tehran are old and bitter enemies. Iran and Saudi Arabia's proxy war in the Middle East runs far deeper than the respective state's interpretation of Islam.

Even the latest phase of the Middle East cold war dates back over a decade to when the US and its allies intervened in Iraq to overthrow Iran's bitter enemy Saddam Hussein and effectively install a Shia government in Baghdad. Iraq, a Shia-majority country long governed by a divisive Sunni despot, suddenly moved back into Tehran's sphere of influence both under Nour al-Maliki and then Haidar al-Abadi, its current leader.

The Baghdad government and Iran's role in it has only been emboldened by the fight against Islamic State (Isis), which has seen Iranian militias led by Tehran's top general, Qasem Soleimani, on the ground in Iraq backed by US air strikes. Tehran and the US fighting on the same side against Daesh in Iraq has come alongside the P5 + 1 nuclear deal, poised to normalise relations between the two countries for the first time since the 1979 revolution.

Riyadh has watched in horror as its old enemy has grown closer to the US both militarily and diplomatically at a time when Saudi Arabia has gradually fallen out of favour. Saudi Arabia's behaviour has been erratic at best since the death of King Abdullah in January 2015 and his replacement by King Salman, his brother. The execution of al-Nimr on New Year's Day was the first time Riyadh had executed a political prisoner in over 30 years – although it has executed hundreds if not thousands of criminals during that period.

The rivalry between Tehran and Riyadh has been manifested in two brutal conflicts. The first, in Yemen, sees Iran backing Houthi rebels in the north of the country as Saudi Arabia backs the forces of ousted Yemeni President Mansour Hadi in the south. As many as 6,000 people have now been killed in the conflict in Yemen, which has fallen into a bloody and dangerous stalemate with no end in sight.

The second conflict is in Syria, where Iran continues to support Bashar al-Assad both directly and through its Lebanese proxy, Hezbollah, as Riyadh funds Islamist militias that are fighting both Assad and Daesh. At the end of 2015 it appeared that Western attitudes towards Assad were softening in the face of Russian support for the dictator, a prospect that shocked Riyadh, which could never tolerate his remaining in power after the war.

This week many have raised the question of where this latest spat leaves the Syria talks in Vienna. Much was made by the US of its ability to get Saudi and Iran at the same table at the end of last year – it is difficult to see a repeat of that given the events of the last week. Iran has broken off the slim relations it had with Riyadh after al-Nimr's death and Saudi has ordered all Iranian diplomats to leave the country.

There is an important domestic element to the conflict too. Saudi has long accused Iran of fuelling tensions in its Shia-majority eastern province, where Sheikh Nimr was a prominent pro-democracy activist, as well as in Bahrain, where the restive Shia majority has long protested against the Sunni royal family in Manama. By putting him to death, Salman is giving a message to Iran that he will not tolerate Iranian meddling in its internal conflicts.

It remains to be seen how far the conflict between Iran and Saudi Arabia will go in the wake of the Nimr executions, but it is likely to remain a cold war. Both countries will likely prefer to continue vying for influence in other states – Lebanon, Yemen, Iraq, and Syria – rather than break into direct conflict. The US and Britain will likely try to avoid taking sides, hence the foreign office's lukewarm condemnation of the recent executions.

The real casualty in all this will be Syria if the spat between Riyadh and Tehran derails talks in Geneva and toughens Saudi and Iranian backing of Islamist groups and Assad respectively. The last thing that the war torn country needs is a proxy war between the Middle East's two superpowers inside its borders. If the war in Syria is to end, there has to be some consensus, however slim, between Saudi Arabia and Iran.

As for the wider region, it is easy to see the sectarian rhetoric that accompanies Riyadh and Tehran's rivalry carried out in the brutal attacks perpetrated by Daesh and other groups. An intensifying of sectarian conflict and its expression in Middle East geopolitics is a frightening prospect indeed.