On January 23, Russian President Vladimir Putin travelled to Israel to attend the commemoration of the 75th anniversary of the liberation of the Auschwitz-Birkenau concentration camp by Soviet forces. This was only his third official trip to the country since he became president in 2001 (he previously visited in 2005 and 2012).

Putin and Russian officials were welcomed in Israel as important guests and the Israeli leadership made clear it was taking Russia's side in its dispute with some Eastern European countries on the Soviet role in the liberation of Europe from the Nazi rule, an issue that is extremely important to the Russian president, who focuses much of his domestic political rhetoric on the Soviet victory in World War II.

Just a week later, on January 30, Israeli Prime Minister Benjamin Netanyahu travelled to Moscow to meet the Russian president. This was the fourth trip of the prime minister to Russia over the past year alone. He visited Putin ahead of the Israeli elections in April and September, hoping to boost his electoral chances. This time, Putin did not disappoint.

He took the decision to release from prison Naama Issahar, an Israeli citizen arrested for alleged drug smuggling at a Moscow airport in 2019. Her detention was deemed a political move aimed at pressuring Israel to release Alexey Burkov, a Russian hacker who faced extradition to the United States.

Significantly, the Kremlin made the decision to let Issahar go despite the fact that Burkov was handed over to the US authorities in November. Her release was another major diplomatic victory for Netanyahu (after the announcement of US President Donald Trump's Middle East plan).

The Kremlin likely calculated that it is better off helping Netanyahu win another term and avoid jail, given that under his government, Russian-Israeli relations have flourished - something Moscow has been pushing for since the 1990s.

At this moment, close relations with Israel, a close ally of the US and the European Union, are important to Moscow for several reasons. First, they undermine Western efforts to put Russia under international isolation for its rule in the Ukrainian war and its annexation of Crimea. Israel is also playing a certain role in helping Moscow leverage its gains in the Middle East in its dialogue with the West for normalisation.

Second, Russia needs close coordination with Israel, which plays a significant role in determining security and political arrangements in the Levant (especially through its alliance with the US), to secure its positions in Syria. The stability of a Russian-backed regime in Damascus is contingent on Israel's cooperation.

Thirdly, Russia and Israel also have strong economic and cultural ties, given the significant population of Jewish immigrants from the former Soviet Union. In 2019, Russian-Israeli trade reached $5bn, bringing Israel into the cohort of Russia's main trade partners in the region.

Significantly, this exchange of visits came just weeks after US drones assassinated Iranian General Qassem Soleimani in Iraq, sparking another escalation of regional tensions. For Tehran, Moscow's strategic partner in the region, these visits must have caused some anxiety.

After all, they were preceded by a rather muted reaction from the Kremlin to Soleimani's killing. While Moscow officially condemned the incident and even offered its mediation to defuse tensions between the US and Iran, it still preferred to distance itself from the situation by keeping relatively silent. This may have seemed surprising to some given the close ties between Russia and Iran and the key position Soleimani within the hierarchy of the Islamic Republic.

Some Kremlin critics explained this reaction with theories about how Russia stands to gain after Soleimani's assassination, but that is really not the case. Moscow neither benefitted much from the temporary and short-lived spike in oil prices after the incident nor from an alleged power vacuum in Syria.

Those gains that Moscow received from high oil prices after Soleimani's killing has already been counterbalanced by the subsequent drop in oil prices due to fears caused by the coronavirus outbreak.

Soleimani's death is also not going to open up much space for Russia in Syria. The late general was definitely an important figure in Iran's foreign operations, but his work was institutionalised and his successor - appointed shortly after his death - will pick up where he left off.

Russia's silence after the assassination had much more to do with its perception that Iran brought this upon itself by provoking the US in Iraq and the Gulf, and with its fear that the incident could lead to aggressive Iranian action against Israel, which is not in its interest.

For years now, Russia has been striking a balancing act between Israel and Iran in the region. By 2015, the Kremlin managed to make Iran and Israel accept the fact that Moscow is not going to choose between them while being equally ready to develop cooperation with both.

This policy has been repeatedly challenged by events surrounding the Syrian civil war, where Israel and Iran have come into direct confrontation. In the spring of 2018, Moscow managed to negotiate an informal agreement between the two countries which largely kept the Iranians and their proxies away from the Syrian-Israeli border in exchange for a halt to Israeli air raids against Iranian positions that did not threaten Israeli security directly.

Since then, the agreement has been violated by both sides repeatedly, but Russia has continued to put pressure on Iran and Israel to de-escalate. The Kremlin has threatened to leave the Iranian forces and proxies without Russian air support and has warned Israel that if it continued its aggressive air raids against the Iranians beyond southern Syria, it will supply Damascus with additional air defence systems (S-300, TOR-M1 and etc).

This position of an arbiter gives Russia both political leverage in the region and international prestige and for this reason, it would very much like to preserve the status quo of Israeli-Iranian tensions without open conflict.

An Iranian strike against Israel, however, would disrupt this status quo. Iran has always clearly articulated that in the case of US actions against Iran, US allies in the region will be the main targets of Iranian retaliation. Consequently, after Soleimani's assassination, Haifa, one of the largest Israeli cities, was named as one of the potential targets for a revenge attack.

While the US showed little interest in protecting Gulf countries against Iranian aggression, Israel could be different. An attack on its closest ally would likely elicit a response from Washington, plunging the region into a major conflict. And that is what Russia wants to avoid at any cost because it would force it to take sides and get involved, which would inevitably result in diplomatic losses.

Another conflict near the borders of Russia's sphere of influence in Central Asia would also negatively affect the stability of the post-Soviet space and divert its attention from the wars in Syria and Libya, where it is playing a pivotal role.

The fall of the current regime in Tehran as a result of US military action is also not in Russia's interest. It considers Iran an important player in the Middle East, a bulwark against US hegemony and a convenient partner on occasion which can give Russian diplomatic initiatives in the region important backing. A new government in Tehran may not necessarily have pro-Russian sentiments or be interested in working with Moscow on a wide array of issues.

For this reason, while the Russian leadership may enjoy its rapprochement with Israel and the international diplomatic gains that come with it, it would always staunchly oppose any action that threatens the regime in Tehran.

In this context, Iran's decision to de-escalate after Soleimani's death by launching limited attacks against US positions in Iraq has come as a relief for Russia. Yet, the risk of another US-Iran escalation remains high, which means Moscow will likely have a difficult time maintaining its balancing act between Tehran and Tel Aviv in the future.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial stance.