Saudi Arabia faces a difficult dilemma.
Since the United States and Israel launched their war against Iran on February 28, Riyadh has largely tried to stay out of it. But now, after being attacked on three different fronts, the Saudis have said enough.
This week, they carried out joint attacks with the United States against pro-Iran militias in Iraq, which they accuse of launching drones against the Kingdom.
For Saudi Arabia, the dilemma now is whether to continue counterattacking as a deterrent or try to reduce tension, perhaps by winning over some of its adversaries by making concessions.
Who attacks who and why?
First, a little context. In the conflict that has been ravaging the Gulf area and other parts of the Middle East for five months, there are basically two sides.
On the one hand there is Iran and its Islamic Revolutionary Guard Corps (IRGC). Allied to them are the Houthis in Yemen, a tribal group that took control of much of the country in 2014.
Iran also backs the Popular Mobilization Forces in Iraq, the paramilitary group that has reportedly carried out 30 drone strikes against Saudi Arabia and has now been attacked in retaliation.
Then there is Hezbollah in Lebanon, which remains a powerful force but currently keeps a low profile.
On the opposite side of this conflict is the United States, with its powerful Central Command (Centcom) forces, as well as the Arab Gulf States and Jordan, to varying degrees. Israel remains a close ally of the United States, but is not currently actively involved in this war.
Iran has recently concentrated its drone and missile attacks on Jordan, Kuwait and Bahrain, in addition to attacking any merchant ship that attempts to pass through the Strait of Hormuz avoiding the new rules and sea routes imposed by Tehran.
The addition of Iraqi militias and Yemen's Houthis is a relatively new phenomenon and demonstrates how, without a lasting peace deal between the United States and Iran, the region risks becoming increasingly embroiled in a widening conflict.
Dodge war
There are several reasons why Saudi Arabia is trying not to become embroiled in a large-scale conflict.
Its de facto ruler, the relatively young Crown Prince Mohammed Bin Salman, wants to guide the country toward a long-term national transformation plan known as Vision 2030.
Its objective is to diversify the Kingdom's economy, reducing its dependence on oil revenues, and create dynamic and modern national industries that provide decent jobs to the hundreds of thousands of graduates and young people who complete their studies and enter the labor market each year.
Part of Vision 2030 involves attracting foreign investment. Another part is building infrastructure like data centers, which are vulnerable to attacks.
This is not going to work if Saudi Arabia is under constant, long-term threat from Yemen's Houthis launching drones across its southern border, or from ballistic missiles fired directly by Iran.
In September 2019, the Saudis suffered a severe blow.
With relations with Iran in a sorry state, the Saudis woke up to the news that an Iranian puppet militia in Iraq had launched a fleet of drones against two of their most important oil facilities, in Abqaiq and Khurais.
At the time it was suggested that the attack had come from the Houthis in Yemen, but I visited the site immediately afterwards and could clearly see the holes in the superstructures, all facing north.
That attack paralyzed half of Saudi oil exports for several days and was a wake-up call to Riyadh about how vulnerable its critical national infrastructure is to attacks.
Last Monday, satellite images showed that the Abqaiq oil facility was attacked once again by drones launched from Iraq by pro-Iran militias.
And keeping the flow of oil open
Then there is oil, which remains the engine of the Saudi economy.
In February, Iran retaliated against US and Israeli attacks by de facto closing the Strait of Hormuz, a crucial shipping channel between Iran and the Gulf through which 20% of the world's oil and liquefied natural gas transit.
In response, the Saudis pumped as much oil as they could—about five million barrels a day—through their east-west pipeline to their Red Sea export terminal on the opposite coast at Yanbu.
From there it was loaded onto tankers heading south towards the Arabian Sea, bound for the markets of Asia.
Until then, everything is fine.
But on July 13, the Saudis bombed the Sanaa airport, just outside Yemen's capital. The Yemeni government, supported by Saudi Arabia, claimed responsibility for the attack, stating that its objective was to prevent the landing of an Iranian plane. In retaliation, the Houthis attacked the Saudi regional airports of Abha and Jizan.
What is even more worrying for Riyadh is that the Houthis have begun attacking Saudi vessels in the Red Sea, making the passage of ships through the Bab el Mandeb Strait at the southern end of the Red Sea extremely dangerous. This, in turn, is disrupting Saudi oil exports to Asia.
Riyadh spent seven years trying to subdue the Houthis through bombing, but failed.
The war that devastated Yemen was one of the worst humanitarian disasters of our time and its effects are still being felt.
In 2022, Saudi Arabia agreed to an uneasy truce with the Houthis and there were reports of bribery, but now the region's richest country is once again facing the threat of drone and missile attacks from its southern neighbor, while also suffering attacks from Iraq to the north.
None of this was foreseen in the Vision 2030 plans.
This article was originally written in English and we used an artificial intelligence tool to translate it. A BBC journalist reviewed the text before publication. Learn more about how we use AI.
Download the new BBC World Service app. Choose BBC News Mundo and receive news alerts, documentaries and analysis, all in one place. Important: The new app is not available in the United Kingdom or the United States.