BEIRUT — As the fighting winds down across much of Syria, President Bashar al-Assad's two main backers, Iran and Russia, have been competing for influence and the spoils of war.

Both countries have promoted their respective languages, Farsi and Russian, for instruction in Syrian schools. Both have signed contracts to construct flour mills amid a dire shortage of bread. Both are building power plants.

And both have been vying for contracts in oil extraction, phosphate mining and port construction worth many millions of dollars, according to Jihad Yazigi, the head of the Syria Report, a leading business newsletter. “They are targeting the same sectors, although they haven’t had the same success,” he said.

Russian companies have traditionally prevailed in these contested sectors, for instance winning five oil contracts between 2013 and 2020, though Iran succeeded last year in landing the first Syrian oil contract of its own. In the spring of 2019, Syria announced it was planning to lease the Tartus port to Russia and turn over the container terminal at the Latakia port to Iran, but the latter contract later fell through.

Syria had also initially promised Iran a contract for phosphate mining but changed direction and awarded it in 2018 to a Russian company, which is set to receive 70 percent of revenue from extracted phosphate over 50 years, Yazigi said.

“The Iranians have felt that they haven’t gotten a fair share of Syrian assets relative to their commitment — their military commitment but also their economic commitment,” he said. “The Iranians provided much more economic support. But the economic benefits are going to the Russians more than it is going to the Iranians.”

In 2018, Maj. Gen. Yahya Rahim Safavi, a top military aide to the Iranian supreme leader, Ayatollah Ali Khamenei, urged that Iran be compensated with oil, gas and phosphate contracts for its support to Syria. “Iran can also have long-term political and economic agreements with the Syrian government to repay the expenses it has tolerated,” he said.

Iran began providing military support to Assad as early as 2012 as Syrian opposition fighters were gaining ground against the government. Iran dispatched forces from its Revolutionary Guard Corps’ elite Quds Force as well as Iran-backed militiamen from Iraq and Lebanon and thousands of Afghan Shiite Muslim fighters. In support of Syria’s beleaguered finances, Iran has also extended it three credit lines worth at least $5.6 billion, according to the Syria Report.

Although Russia entered the war later, its 2015 intervention proved crucial, changing the trajectory of the conflict at a time when Assad was on the ropes. Russian warplanes provided air cover for the Syrian army and its allies and pounded opposition-held neighborhoods, helping beat back the rebels. As the war dragged on and international sanctions mounted, Syria also turned to Russia for investment.

Ten years after the anti-Assad uprising began, government forces have reasserted control over most of the country with the opposition relegated to the besieged Idlib enclave in northwest Syria. But destruction is widespread and the economy practically in free fall.

Syria historically has had stronger economic relations with Russia than with Iran. But Iran has managed to carve out part of the Syrian market. Electronics and medicine, for example, are increasingly imported from Iran. Syrians calling pharmacies in Damascus to ask about the availability of medicine are becoming accustomed to hearing: “And there’s also an Iranian alternative.”

Iran’s anti-Western defiance has also resonated among some Syrians. When the Iranians opened a new entertainment complex in Damascus in March, a plaque bearing the photographs of Khamenei and assassinated Iranian commander Qasem Soleimani alongside Assad greeted visitors to the gardens, water fountains and soccer fields. In eastern Syria and Damascus, Iran has built cultural centers, where events like a recent photo exhibition marking the anniversary of Soleimani’s death are held.

Iran is also building a 12-story trade center in the heart of the capital, Iranian media reported, where 24 Iranian companies will be based.

But Russia beat Iran into Syria’s schools, getting Russian listed as an alternative to French as a second language for instruction. The first high school Russian exams were held last year.

Iran continues to push for Farsi to be officially introduced as well. Last year, when Iran signed an agreement calling, in part, for it to help Syria rebuild its schools, Iranian Education Minister Mohsen Haji-Mirzaei emphasized the “importance of inserting the Farsi language in the Syrian educational system,” Syrian state media reported. Iran has introduced Farsi courses at some of the schools it has helped repair or construct.

Some schools in Raqqa and Deir Ezzor provinces have already added Farsi classes to elementary and middle school curriculums, and some Syrians are concerned that the same will happen in Aleppo, where Iran announced this month it plans to open a consulate.

Iran and Russia have also invested in building flour mills across the country. The first of five mills erected under a contract with Iran and financed by an Iranian credit line opened two years ago, the Syrian state news agency reported.

A Russian company, for its part, announced in 2017 that it had won a nearly $84 million contract to build four mills in central Homs province. Russia is also benefiting from direct exports of wheat to Syria, which totaled more than 1 million tons a year between 2017 and 2019, according to Russian and Syrian officials quoted by several news agencies.

The Syrian wheat shortage came after mills were destroyed in fighting and fields ruined by drought or fires set by the Islamic State.

The bread crisis reflects in large part the wider economic upheaval in Syria, where the currency has collapsed. More than 13 million people are said by the United Nations to require humanitarian aid after suffering a decade of war, which has caused economic losses estimated at nearly half a trillion dollars.

Russian-Iranian competition has extended at times into the diplomatic realm. In December, incoming Syrian foreign minister Faisal Mekdad chose Iran for his first international visit. Russian Foreign Ministry spokeswoman Maria Zakharova dismissed those “reading between the lines” looking for tensions between Russia and Iran. She added that Mekdad had intended to visit Russia but was delayed because of the Russian foreign minister’s busy schedule.

Russia is seeking to help Syria rebuild bridges with the wider Arab world, most of which views Iran with suspicion. Russia also backs a U.N.-facilitated constitutional committee assigned with rewriting the constitution, and the Kremlin has been pushing for presidential and parliamentary elections since 2015 — one year after elections were held, and six years earlier than the constitution requires.

Iran’s strategic interests seem to be focused in large part on controlling a land corridor that stretches from Syria’s eastern border with Iraq all the way to the Mediterranean. This corridor would allow Iran to far more easily supply its ally Hezbollah in Lebanon with weapons and other materiel.

“It’s not only money” that Iran wants, said Omar Abu Layla, the head of a monitoring network called Deir Ezzor 24. “It’s geography.”

He said real estate is bought up by Iranians in eastern Syria for homes and businesses as well as in and around Sayyidah Zeinab, a Damascus suburb and home to a shrine revered by Shiites.

To secure its interests in the east, where Iranian-backed militias hold sway, Iran has focused on garnering local support through security and education. “It’s [a process of] recruitment and garnering of sympathy, targeting this generation,” Abu Layla said. A recent uptick in attacks in the area, carried out by Islamic State cells, has pushed more of the population to accept, or align themselves with, the Iranian-backed militias out of fear.

Many Syrians reject Iranian encroachment, however. Fears of rising Shiite influence have mounted as the Iranian presence has grown over the past decade and Iranians have bought real estate. In hushed tones, Sunni Muslim residents point out videos from the past few years showing men beating their chests, a Shiite tradition on days of mourning, in the heart of Damascus’s ancient market.