Saudi Arabia and Iran are at loggerheads. They have long been rivals, but it's all recently got a lot more tense. Here's why.
How come Saudi Arabia and Iran don't get along?
Saudi Arabia and Iran - two powerful neighbours - are locked in a fierce struggle for regional dominance.
The decades-old feud between them is exacerbated by religious differences. They each follow one of the two main branches of Islam - Iran is largely Shia Muslim, while Saudi Arabia sees itself as the leading Sunni Muslim power.
This religious schism is reflected in the wider map of the Middle East, where other countries have Shia or Sunni majorities, some of whom look towards Iran or Saudi Arabia for support or guidance.
Historically Saudi Arabia, a monarchy and home to the birthplace of Islam, saw itself as the leader of the Muslim world. However this was challenged in 1979 by the Islamic revolution in Iran which created a new type of state in the region - a kind of revolutionary theocracy - that had an explicit goal of exporting this model beyond its own borders.
In the past 15 years in particular, the differences between Saudi Arabia and Iran have been sharpened by a series of events.
The 2003 US-led invasion of Iraq overthrew Saddam Hussein, a Sunni Arab who had been a major Iranian adversary. This removed a crucial military counter-weight to Iran. It opened the way for a Shia-dominated government in Baghdad and Iranian influence in the country has been rising ever since.
Fast-forward to 2011 and uprisings across the Arab world caused political instability throughout the region. Iran and Saudi Arabia exploited these upheavals to expand their influence, notably in Syria, Bahrain and Yemen, further heightening mutual suspicions.
Iran's critics say it is intent on establishing itself or its proxies across the region, and achieving control of a land corridor stretching from Iran to the Mediterranean.
How have things got worse?
The strategic rivalry is heating up because Iran is in many ways winning the regional struggle.
In Syria, Iranian (and Russian) support for President Bashar al-Assad has enabled his forces to largely rout rebel group groups backed by Saudi Arabia.
Saudi Arabia is trying desperately to contain rising Iranian influence while the militaristic adventurism of the kingdom's young and impulsive Crown Prince Mohammed bin Salman - the country's de facto ruler - is exacerbating regional tensions.
He is waging a war against the rebel Houthi movement in neighbouring Yemen, in part to stem perceived Iranian influence there, but after four years this is proving a costly gamble.
Iran has denied accusations that it is smuggling weaponry to the Houthis, though successive reports from a panel of UN experts have demonstrated significant assistance for the Houthis from Tehran in terms of both technology and weaponry.
Meanwhile in Lebanon, Iran's ally, Shia militia group Hezbollah, leads a politically powerful bloc and controls a huge, heavily armed fighting force. Many observers believe the Saudis forced Lebanese Prime Minister Saad Hariri, whom it backs, to resign in 2017 over Hezbollah's involvement in regional conflicts. He later returned to Lebanon and put the resignation on hold.
There are also external forces at play. Saudi Arabia has been emboldened by support from the Trump administration while Israel, which sees Iran as a mortal threat, is in a sense "backing" the Saudi effort to contain Iran.
The Jewish state is fearful of the encroachment of pro-Iranian fighters in Syria ever closer to its border.
Israel and Saudi Arabia were the two countries most resolutely opposed to the 2015 international agreement limiting Iran's nuclear programme, insisting that it did not go far enough to roll back any chance of Iran obtaining the bomb.
Who are their regional allies?
Broadly speaking the strategic map of the Middle East reflects the Shia-Sunni divide.
In the pro-Saudi camp are the other major Sunni actors in the Gulf - the UAE and Bahrain - as well as Egypt and Jordan.
In the Iranian camp is Syria's President Bashar al-Assad, a member of a heterodox Shia sect, who has relied on pro-Iranian Shia militia groups, including the Lebanon-based Hezbollah, to fight predominantly Sunni rebel groups.
Iraq's Shia-dominated government is also a close ally of Iran, though paradoxically it also retains a close relationship with Washington on whom it has depended for help in the struggle against so-called Islamic State.
How is the Saudi-Iranian rivalry being played out?
This is in many ways a regional equivalent of the Cold War, which pitted the US against the Soviet Union in a tense military standoff for many years.
Iran and Saudi Arabia are not directly fighting but they are engaged in a variety of proxy wars (conflicts where they support rival sides and militias) around the region.
Syria is an obvious example, while in Yemen Saudi Arabia has accused Iran of supplying ballistic missiles fired at Saudi territory by the rebel Houthi movement.
Iran is also accused of flexing its muscle in the strategic waterways of the Gulf, through which oil is shipped from Saudi Arabia. The US says Iran was behind recent attacks on foreign tankers there - something it denies.
Are we heading towards a direct war between Saudi Arabia and Iran?
So far Tehran and Riyadh have fought via proxies. Neither is really geared up for a direct war with the other but a major Houthi attack against the Saudi capital or, as in the most recent case, against a key economic target could upset the apple cart.
Houthi attacks against Saudi Arabia's infrastructure have inevitably added a new front to the confrontation between Tehran and Riyadh. As in the Gulf, where Iran and Saudi face each other across a maritime border, rising tensions could risk a much broader conflict.
For the US and other Western powers, freedom of navigation in the Gulf is essential and any conflict that sought to block the waterway - vital for international shipping and oil transportation - could easily draw in US naval and air forces.
For a long time the US and its allies have seen Iran as a destabilising force in the Middle East. The Saudi leadership increasingly sees Iran as an existential threat and the crown prince seems willing to take whatever action he sees necessary, wherever he deems it necessary, to confront Tehran's rising influence.
Saudi Arabia's vulnerability has been demonstrated by these latest attacks on its oil installations. If a war breaks out, it will be more perhaps by accident rather than design. But the Saudis' own activism, encouraged in part by a lingering uncertainty as to the Trump administration's own goals in the region, inevitably adds another element of tension.