The Gaza-Israel conflict could cut both ways for Russian President Vladimir Putin AFP

The conflict between Hamas and Israel is both an opportunity and a risk for Russian President Vladimir Putin, who has been mired in pressing his invasion of Ukraine for the past 19 months.

Here is an overview of five of Putin's objectives that are expected to shape his foreign policy:

The crisis in the Middle East has diverted international attention from Ukraine, which has battled to repel Russia's invasion for more than 600 days.

"The Hamas raid and its consequences actually contribute to the erosion of general Western interest in Ukraine," wrote Igor Delanoe, deputy director of the Franco-Russian Observatory think tank.

Alexander Gabuev, the Berlin-based director of Carnegie Russia Eurasia Center, said he expected senior US officials such as US Secretary of State Antony Blinken and White House national security adviser Jake Sullivan to spend much of their time on the Middle East crisis in the coming months.

"This conflict is a boon for Russia because it diverts a huge amount of attention of the United States and the West," Gabuev told AFP.

The Middle East has traditionally been a region of huge importance to Russia and it has contacts with Palestinian groups including Hamas and often thorny ties with Israel in a complex relationship going back to the Soviet era.

Hanna Notte, an analyst at the Washington-based Center for Strategic and International Studies, said she had not seen any evidence of "direct Russian backing for Hamas and this attack - planning, weapons, execution."

"And to be clear: there was no need for Russian assistance," she added.

Tatiana Stanovaya, head of R.Politik, a political analysis firm based in France, said that an escalation in the region leading to a conflict between Iran and Israel "could jeopardise Russia's established presence in the Middle East and its long, ongoing campaign in Syria."

Russia's military bases in Syria are an important hub and help project "Moscow's influence in Africa as well as the Middle East," Stanovaya added.

The tightening of ties between Tehran and Moscow has become one of key objectives of Russian diplomacy given the massive use of Iranian drones in Ukraine by the Russian army.

But the rapprochement is not without risks as the Islamic Republic is a top backer of both Hamas and Hezbollah.

"Russia's war in Ukraine has driven closer military ties with Iran. Hamas officials have visited Moscow at least three times since Russia invaded Ukraine," said Nigel Gould-Davies, a senior fellow at the International Institute for Strategic Studies.

"The question has always been how far such cooperation could go without causing (Israel) to rethink its ties with Moscow. Moscow must also fear that a severe retaliation against Iran could weaken one of its few close allies."

At the same time, Moscow must manage a careful balancing act in its ties with Israel, especially given the strong personal relations between Putin and Israeli Prime Minister Benjamin Netanyahu, a frequent guest in Russia.

Israel has refrained from sending any weapons to Ukraine following Russia's invasion of Ukraine.

"The Kremlin has so far succeeded in keeping (Israel) out of the war in Ukraine, and would like this Western country not to be an additional supporter of Ukraine," said Dimitri Minic of the French Institute of International Relations (IFRI).

But Putin conspicuously refrained from using the word "terrorist" to describe the Hamas attacks.

That stance is indicative of Moscow's "changed political priorities and of the extent to which Russian messaging now caters to pro-Palestinian constituencies in the Middle East and across the Global South," said Notte.

Putin says he wants to shape a new world order together with China as well as Moscow allies in Iran and North Korea.

The Kremlin chief has openly blamed Washington for the turmoil in the Middle East.

Stanovaya said that the crisis "helps to fan anti-Western narratives by attributing general global instability and the reopening of historic disputes to the West."

Minic of IFRI noted that some countries in the so-called Global South and Russia were united in their "resentment, even hatred and very often an irrational perception of the West."

"And this relationship with the West has a number of sources which form an inexhaustible breeding ground for Moscow."