When Saudi Arabia executed a leading Shi'ite cleric and protesters responded by torching the Saudi Embassy in Tehran, Sudan was one of only three countries to sever ties with Iran in solidarity with Riyadh.
The January 4 move cemented a dramatic political shift: In the past two years, Sudan has turned its back on a quarter-century alliance with Iran in favor of the Saudis, who have proved more willing to provide the financial support it sorely needs.
Saudi Arabia has already invested more than any other country in Sudan — about $11 billion, mostly in agriculture. In the past year, it has deposited $1 billion in Sudan's central bank, signed deals to finance the construction of power-generating dams on the Nile and pledged even more investment in farming.
Such largesse explains why Sudan, struggling with a collapsing currency and soaring unemployment, has chosen to favor economic ties with Saudi Arabia over a relationship with Iran that was largely based on arms.
"The government decided to distance itself from the alliance with Iran after it evaluated the relationship and found it economically and politically damaging," said Al Tayeb Zeinalaidine, politics professor at Khartoum University. "Iran didn't offer any economic aid to Sudan, and this left the government thinking its relations ... had become a burden."
New Bashir move
The swing toward Riyadh marks a new tack for Sudanese President Omar Hassan al-Bashir, who has maintained power for over 25 years in a volatile neighborhood by navigating shifting alliances. At different times he has drawn close to Osama bin Laden, the United States and Tehran.
Last year he joined a Saudi-led coalition fighting Houthi rebels in Yemen who are allied with Shi'ite Iran, showing Sunni Gulf Arab powers that he could be an asset in their fight to limit the influence of the Islamic Republic.
Sudan's defense ministry says it has deployed three military jets as well as ground troops to secure facilities in the southern port of Aden and elsewhere, though they have been involved in little active combat so far. Sudan has also trained thousands of Yemeni troops.
For much of the period since Bashir seized power in 1989, ties with Saudi Arabia had been tense. Bashir backed Iraq's 1990 invasion of Kuwait, a Saudi neighbor, and protesters took to the streets of Sudan to support Iraq's Saddam Hussein and condemn the Saudi royals.
As recently as 2013, relations reached a nadir when Saudi Arabia banned Bashir's plane from passing through its airspace to Iran.
By contrast, Bashir fostered warm relations with Tehran, crowned with the 1991 visit of then-President Hashemi Rafsanjani. The two countries, both listed as state sponsors of terrorism and subjected to U.S. sanctions, saw mutual benefit in teaming up against Western attempts to isolate them.
Sudan helped Iran project its influence by serving as the key entry point for Iranian weapons exports to Africa, according to sources who monitor the arms trade. Khartoum denies taking part in these activities.
In exchange, Sudan benefited from Iranian military technology that has helped it become a major African weapons producer.
But the calculus has shifted as Sudan's economic problems have mounted — especially since it lost three-quarters of its oil revenues when South Sudan seceded in 2011.
Military spokesman Ahmed al-Khalifa al-Shami said the army backed the policy shift, and military cooperation with Iran had been more limited than media reports would suggest.
"The army has not been harmed by the severing of relations with Iran because all the military production is being done with Sudanese labor and expertise," Shami said.
Sudan has said its support for the Yemen campaign was a turning point in the Saudi relationship, but was not linked to more investment. Nor did it cut ties with Iran in return for Saudi aid.
Ali al-Sadeq, Sudanese Foreign Ministry spokesman, said Sudan saw much more in the new relationship.
"We are looking to a strategic partnership with Saudi Arabia," he said. "We are neighbors on the Red Sea coast and work together to secure these coastlines against challenges. ... We expect in the coming period more progress in cooperation."