Caught between two vast neighbours locked in a regional struggle, Oman has long been to the Middle East what neutral Switzerland is to global diplomacy. But now its policy of being "friends to all and enemy to none" is under heavy strain.

Oman has never found it easy to balance relations with Saudi Arabia to the west and Iran to the north, but worsening rivalry between the region's dominant Sunni and Shi'ite powers is testing its cherished policy of non-alignment more than ever.

That policy has been felt far beyond the small but strategically-located sultanate on the Strait of Hormuz, through which 40 percent of the world's seaborne crude oil flows.

Oman helped to mediate secret U.S.-Iran talks in 2013 that led to the historic nuclear deal signed in Geneva two years later. It has also helped to free American hostages in Yemen.

Omanis believe this Swiss-style peacemaker role is vital in helping to prevent the Middle East from sinking even deeper into chaos.

"We hope Oman will stick to the same policies. A full-blown conflict between Iran and Saudi Arabia would be a disaster for everyone," said Tawfiq al-Lawati, a member of Oman's consultative Shura Council.

However, an assertive Saudi Arabia, which is leading a bombing campaign against Iranian-allied rebels in Yemen, has insisted that the Gulf Arab monarchies draw closer together to confront Tehran.

At the same time, Oman is struggling with a vast budget deficit largely due to low global prices of its oil exports. Muscat is therefore looking to raise trade with Iran, following the easing of international sanctions on Tehran under the nuclear deal, to buttress its economy.

As a result, Muscat has had to walk a diplomatic tightrope. "With Saudi Arabia we do sometimes have disagreements and with Iran too," said Lawati. "But there is still more bringing us all together."

Muscat surprised neighbours last week by agreeing to join a Saudi-led military coalition - not the one fighting in Yemen but a separate, larger grouping. This is officially aimed at fighting Islamic State and other militants but suspected of serving also as a counter to Tehran around the Muslim world.

Gulf Arab citizens hailed the decision as a sign that their nations were finally closing ranks against the perceived Iranian menace. Oman had "returned to the bosom of the Gulf", said prominent Saudi columnist Turki al-Dakhil.

King Salman is expected to visit Muscat shortly, Saudi and Gulf sources have said, in what would be a sign of strengthening relations. "In grave times, clear positions are needed," said a Gulf Arab official. "We of course know Oman will stand with us."

"Still Neutral"

And yet Oman may struggle to please its wealthier fellow Gulf Arabs consistently. They interpret neutrality as disregard for the Gulf's shared security during wars in Iraq, Syria and Yemen where Riyadh and Tehran back opposing sides.

Joining the Saudi-led alliance signals Oman's concern over the spread of Islamic State and Al Qaeda militants who have vowed to carry out attacks on the Gulf Arab monarchies. Oman also faces some domestic uncertainty as 76-year-old Sultan Qaboos has no named successor.

But a transformation of the foreign policy balancing act does not appear to be in prospect.

A former Omani diplomat, who declined to be named, described the move as a "largely symbolic" gesture to accommodate Riyadh and said it would involve "little material commitment".

Ahmed al-Mukhaini, a former Assistant Secretary General for the Shura Council, suggested the move may give Oman more influence to calm strained regional nerves but "would not compromise our independence".

"It might even give Oman more leverage, more space, to play a better role in this coalition and the region. By joining the coalition Oman is shielding itself from criticism from Saudi Arabia," he added.

Pipeline Politics

There are economic risks to a Saudi rapprochement. Any perception that Muscat is allying with Riyadh may irk Tehran, analysts say. Iran has billions of dollars of foreign reserves in Omani banks and could pull the plug on promised projects in the sultanate.

The nuclear deal has offered hope of a leap in trade between Oman and its gas-rich neighbour. Muscat expects the end of sanctions to speed the completion of a liquefied natural gas pipeline, which it hopes will feed energy-intensive industries.

"Oman needs the economic cooperation that Iran has pledged ... The two countries' planned subsea gas pipeline is an important part of the sultanate's plans for economic improvement," said Giorgio Cafiero, CEO of Gulf State Analytics.

Oman sees foreign investment from Iran, including a car factory, a hospital complex and a nanotechnology plant, as helping economic diversification away from oil, he added.