Iranian President Hassan Rouhani, center, attends a session of Iran’s Assembly of Experts in Tehran. Rouhani is slated to travel Monday to Moscow to meet Russian President Vladimir Putin. (Ho/AFP/Getty Images)

As U.S. influence wanes across the Middle East, Iran and Russia have joined forces to expand their power in the region, strengthening political and diplomatic ties and stepping up joint military operations in Syria.

In a sign of the closer relations, Iranian President Hassan Rouhani is slated to travel Monday to Moscow to meet Russian President Vladimir Putin. It is expected to be Rouhani’s last major trip before he faces reelection in May.

Together, the two countries have fought Syrian rebels, sidelined the United States from regional diplomacy and embraced each other as bulwarks against the West.

In a meeting Tuesday, Putin and Rouhani are scheduled officially to discuss projects in areas such as energy, infrastructure and technology. Unofficially, however, the talks are likely to be dominated by their tacit alliance in the Middle East.

“The visit shows the importance that Russia has in Iranian foreign policy. For Russia, Iran is one of their most important political allies,” said Mohsen Milani, executive director of the Center for Strategic and Diplomatic Studies at the University of South Florida.

Iran is “playing a key role in Putin’s longer-term strategy to become a major player in the Middle East,” said Milani, who is also the author of “ The Making of Iran’s Islamic Revolution: From Monarchy to Islamic Republic .”

But Iran and Russia, which compete with each other in global energy markets and have publicly sparred over stalled weapons deals, were never traditional allies. For decades, they have been wary of the other’s intentions, and leaders on both sides remain cautious of the growing ties.

Still, the level and scale of the cooperation — including Russia’s use of an Iranian air base for Syrian operations last fall — has been unprecedented, analysts say. The partnership has been driven by the two countries’ shared goals in Syria, where a rebellion has threatened Syrian President Bashar al-Assad, an ally of both Iran and Russia.

“Since the Russians got more heavily involved in Syria, the relationship between Moscow and Tehran has entered a new phase,” said Ellie Geranmayeh, a senior policy fellow at the European Council on Foreign Relations.

When Syria’s revolt began in 2011, the country was host to Russia’s only military base in the Middle East. And for Iran, Syria provided a stable land corridor through which to send arms and cash to the Lebanese Hezbollah.

As the Obama administration weighed intervention to support Syria’s rebels, Iran and Russia stepped up with weapons and manpower to back the regime. Russia provided air cover for Iranian military advisers and proxy forces on the ground. The coordination ended up defeating the rebels in Aleppo — empowering Iran and Russia, along with Turkey, to set up parallel peace talks that cut out the United States.

“If you look at Syria and the way that Syria has evolved, it has become the crucible of cooperation between Tehran and Moscow,” said Geranmayeh, whose work focuses on Iranian foreign policy, “and pushed their political links to a new level of military cooperation.”

Various power factions in Iran had long pushed for closer relations with Russia, Geranmayeh said. But Rouhani’s moderate government insisted on a more balanced foreign policy, eventually securing a nuclear deal under which U.N. and other sanctions were lifted.

But that outreach to the West has not proved as fruitful as expected, and Rouhani is under fire at home for failing to deliver economic progress.

Ahead of the election in Iran, “Rouhani is trying to solidify his position and demonstrate that while he has been willing to negotiate with the West and the United States, he is equally willing to solidify Iran’s relationship with Russia,” Milani said.

Beyond the potential ramifications at home, Iran is also worried that Putin will normalize ties with what appears to be a more Russia-friendly Trump administration. On Iran, President Trump has taken a much more hawkish stance than his predecessor, putting the Tehran government “on notice” within the first two weeks of his presidency.

“There’s a big concern in Tehran that Moscow will use it as a bargaining chip for better relations with Washington,” said Maxim A. Suchkov, the Moscow-based editor of Russia-Mideast coverage at Al-Monitor, an online news portal focused on the region.

This is an issue on which “Rouhani may need if not solid guarantees then at least some confidence” that Putin will not undercut Iran, Suchkov said.

There are similar worries among Iranian leaders over Russia’s relationship with Israel, which has carried out strikes on Hezbollah targets and Iranian ground forces in Syria.

Rouhani will want to persuade Putin to refrain from aiding Israel to counter Iran “or share sensitive intelligence information” that could hurt Iranian positions in Syria, Suchkov said.

But Geranmayeh said that while the Israel factor limits Iran-Russia relations, it is unlikely Moscow would “even entertain the notion of marginalizing Iran in Syria, especially when they are proving to be quite an effective partner on the ground.”

“Russia legitimately sees itself as a global player and sees Iran as an important regional player to consider,” she said. “Iran won’t necessarily override other important regional players like Israel.”

Some in the Trump administration believe that “it would be possible for the U.S. to get much tougher on Iran and also maintain a good relationship with Russia in Syria,” Milani said.

“You would have to be exceptionally talented with some sort of divine protection to pull off that kind of diplomatic coup d’état,” he said.

Not only is their cooperation effective on the ground, “but the relationship between Iran and Russia is much more comprehensive than the future of Assad or the future of Syria,” Milani said.

Read more:

Senators agree on Iran sanctions measure

Former Iranian president Ahmadinejad banned Twitter. Then he joined it.

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news