On a visit to the Kremlin last week, Israeli Prime Minister Benjamin Netanyahu expressed to his host, President Vladimir Putin, Israel’s strong concerns over reports that Iran intends to establish a naval presence on Syria’s Mediterranean coast and deploy Hezbollah and other pro-Iranian forces near the Golan Heights.

This was Netanyahu’s fourth trip to Moscow in 18 months. Netanyahu and Putin maintain close relations, and frequently speak over the phone. Over the years Russian and Israeli officials have learned to understand each other well. Yet, as Putin’s spokesman said after the meeting, no decisions were taken and none had been expected.

Even as the Russian leader was welcoming the Israeli prime minister, the Russian Navy’s Caspian Flotilla was hosting Iranian sailors who had arrived in Makhachkala, Russian Dagestan, on a friendly visit. In Syria, Russia and Iran are military allies. Russian ships engaged in a spectacular display of their newly acquired capabilities in October 2015, when they fired cruise missiles from the Caspian Sea over Iranian territory at targets in Syria. Russians operate from the air in Syria, while the Iranians and their proxies fight alongside Syrian government forces on the ground.

So, which way will Moscow go? After the capture of Aleppo last December, the focus in Syria has been on diplomacy. Russia has essentially won the war. It is now seeking to win the peace, no less difficult a task. To move ahead, Moscow first recruited Turkey as a key partner in making the Syrian opposition accept a truce and join talks about a future political settlement. It then formed a diplomatic trio with Turkey and Iran to back such talks. It also found the venue for these conversations in Astana, Kazakhstan, whose leader Nursultan Nazarbayev is a close partner of Putin.

Putin realizes full well that winning the peace in Syria involves not only finding common ground among the Syrian parties, but also engaging in a highly complex effort of give-and-take among the regional actors involved. The case of Turkey is particularly telling. In late 2015, Moscow’s policies in Syria directly collided with Ankara’s, leading to the downing of a Russian bomber by Turkey and a seven-month-long chill in relations. Last week Turkish President Recep Tayyip Erdogan followed Netanyahu to Moscow to finalize the normalization of Turkish-Russian relations. In doing so, Erdogan had to give up on his demand that Assad leave power, and he has effectively recognized Russia’s central role in Syria. Putin, for his part, took to heart Turkey’s own security concerns.

Last August, after Erdogan’s conciliatory visit to Saint Petersburg, the Russian leader gave a quiet nod to Turkey’s limited invasion of northern Syria, which aimed at preventing the formation of a Kurdish enclave along Turkey’s border with Syria. In January and February of this year, Russia’s air force bombed Islamic State targets in Al-Bab to support the Turkish assault on the city. This month, the Turkish and Russian military chiefs of staff, alongside the chairman of the U.S. joint chiefs of staff, met in Adana, Turkey to coordinate their forces’ actions. American and Russian troops are a few kilometers apart in the town of Manbij. With Washington and Moscow supporting the Kurds, both are seeking to prevent clashes between the Kurds and the Turkish and Syrian government forces.

This illustrates Russia’s main goal and its general approach. It has neither the resources nor the ambition to displace the United States as the dominant power in the Middle East—a burden that has become too heavy for the U.S. itself. Rather, Moscow seeks the position of a broker that has working relations with all relevant parties, but avoids becoming an all-out ally or adversary with respect to any of them. Conflicts can be repaired on the terms that the Kremlin finds acceptable, as with Erdogan’s Turkey. Its alliances are situational and limited, not to be compared to NATO or the U.S.-Israeli relationship. Russia’s support for President Bashar al-Assad is conditional, and its coalition with Iran is situational.

Russia treats Iran as a serious and often willful player, not to be taken lightly. There is hardly much love lost between the two. Yet, when the interests of Moscow and Tehran coincide, the two can interact productively. Working together 20 years ago, they managed, by diplomatic means, to hammer out a negotiated settlement that ended the bloody civil war in Tajikistan, which has been mostly stable ever since. In Syria, both parties shared an interest in helping Assad defend his regime against an armed opposition. But that is as far as it goes.

Russians, while not sharing Tehran’s wider regional agenda, agree that Iran needs to be part of the Syrian settlement, alongside other regional players, including the Saudis. They are probably realistic enough to understand that Tehran would want to preserve some form of a connection to its Hezbollah allies. However, the Russians also understand that an Iranian or Hezbollah military presence in Syria, particularly near the Golan Heights, would be a constant source of conflict with Israel, undermining the very political settlement Moscow is trying so hard to achieve.

Russia does not wholly accept Israeli views on Iran. In the most recent meeting with Netanyahu, held on the eve of the Purim holiday, Putin suggested that Iran deserved to be approached in a level-headed, unemotional way. However, Moscow has a history of taking Israeli security interests seriously. It has desisted from providing Damascus with S-300 air defense systems. It did not protest against Israeli strikes on Hezbollah targets inside Syria. When it brought its own air power and air defenses to Syria, it made a point of coordinating with the Israelis from the very start, to avoid incidents. So far, this has worked.

Going forward, Moscow’s interest in Syria is to legitimize its own air and naval presence in the country after a political settlement is reached. While the ceasefire is still fragile, the fight against the Islamic State is gaining momentum. The future of Syria is uncertain given that foreign forces will continue to operate in the country. After the settlement, as far as Moscow is concerned, all should leave—except for Russia, which has won basing rights from the Syrian government.

It is totally unrealistic to hope that Russia will throw Iran under the bus for the sake of a rapprochement with the Trump administration or even better ties with Israel. Russia will continue to pursue its own self-interest in the Middle East, which requires preserving working relations with all major actors, including Iran. However, Moscow is also developing a keen understanding of the delicate balances in the region which must not be disturbed. In that sense, they have a clear empathy for Israel’s situation.