Morocco has its own motivations for publicly cutting ties with Iran, but moving against Tehran also helps advance one goal of Saudi Arabia's foreign policy, which is building a network of regional allies willing to challenge Iran's influence.
Morocco announced on May 1 that it is closing the Iranian Embassy in Rabat and recalling its own ambassador from Tehran. Morocco's foreign minister, Nasser Bourita, cited concerns that Iran is supplying weapons, particularly surface-to-air missile systems, to the Polisario Front in the Western Sahara via Iran-allied Hezbollah. But Morocco and Iran have had a rocky diplomatic history for years. In 2009, for example, their ties broke down over Iran's alleged involvement in stoking a Shiite rebellion in Bahrain, a Moroccan ally. At the time, Morocco also accused Iran of attempting to spread Shiite Islam in the kingdom.
Currently, Morocco's decisions and accusations are driven not only by its relationship with Iran, but by local challenges to Morocco's control of the disputed Western Sahara. With an eye toward its own security and territorial integrity, Morocco is seeking to prevent Algeria from furthering its support for the breakaway Polisario movement. In the latest iteration of Algeria and Morocco's decades-long feud, Morocco has recently complained, including to the United Nations in April, about what it sees as an escalated Algerian effort to support territorial gains by the Polisario Front in the disputed Western Sahara region, which Morocco views as its sovereign territory. By publicly airing its concerns about Algerian involvement with the Polisario Front, Morocco's is hoping to accrue more support from allies like the United States, France and the Gulf Cooperation Council states. Because Algeria has friendly relations with Iran, highlighting an Iranian connection in its complaints helps Morocco promote a common cause with states that share its concerns over Iranian actions across the Middle East and North Africa.
For Saudi Arabia, which quickly praised Morocco's decision to cut ties with Iran, the rift between Rabat and Tehran is a small victory — and an opportunity to influence others — as it seeks to build a network of allies that share its regional goals, including containing Iranian influence. Though Morocco no doubt cut ties with Iran primarily for its own security-related reasons, moving publicly against Iran likely wins Rabat further favor with Riyadh, which could yield mutually beneficial financial investment down the road. Since many of the weapons it purchased and used during the Western Sahara war were funded by Saudi Arabia, Morocco is acutely aware of the benefits Saudi Arabia's friendship can bring. And with so many of its allies only tepidly supporting its anti-Iran strategy, Riyadh will take any wins it can get.