But they have very different approaches, roles, and long-term visions.

Russia’s priority is to block what it sees as Western-engineered regime change, part of its policy of opposing interference in any country’s internal affairs, and to preserve Syrian state institutions. It has signaled that it is not wedded to Mr. Assad’s long-term rule.

Iran appears more focused on preserving and expanding its projection of power into the Middle East through relationships with the Lebanese group Hezbollah, other Shiite militias and with Mr. Assad, who has long guaranteed Hezbollah an arms supply route from Iran and belongs to the Alawite sect, a branch of Shiite Islam, the dominant faith in Iran.

At the same time, Iran fueled the growth of Syrian pro-government militias, preferring to work with them. Since jumping into the conflict at a point where Iran seemed unable to keep Mr. Assad from faltering, Russia has tried to integrate these militias into the army.

Iran and Russia face challenges collaborating in the field. Hezbollah fighters and supporters openly disdain the Syrian Army, and grumble that Russia has not given air support to its fighters. And Russian officials feel more comfortable dealing with Syrian Army commanders – many of them educated in Russia — than with the Shiite religious trappings of the militias.

Russia and Iran also differ sharply on Israel. Iran and Israel see each other as irreconcilable enemies, while Russia maintains close relations with Israel, home to a million Russian emigrants.

Then there is Iran’s long memory of the Russian empire battling the Persian Empire and gobbling up its periphery. To Iran, with its millennia-old national identity, it was not that long ago that the Russians were the enemy, fighting for control of Central Asia and the Caucasus

“Russia is not trusted. They just don’t trust each other,” said Cliff Kupchan, the chairman of the Eurasia Group, a Washington-based political risk consultancy. Russia’s flaunting of its Iran base privilege, he said, “was just too much for Iranian domestic politics to bear.”