(Reuters) - Vladimir Putin and Tayyip Erdogan meet on Friday for the second time in just over two weeks, after Turkey helped broker a deal to resume Ukraine's Black Sea grain exports which were blocked by Russia's invasion.
President Erdogan's supporters say the agreement, which could curb soaring global food prices, highlights the importance of NATO member Turkey's diplomatic contacts with both sides.
Although Turkey has criticised the Russian invasion and provided Ukraine with arms, it has broken with Western allies by not imposing sanctions on Russia.
That careful balance reflects the complexity of its ties with Russia, ranging from close cooperation on energy supplies to military competition in Syria, Libya and Azerbaijan.
Days after President Putin and Erdogan met in Tehran last month, Turkey oversaw a deal for the resumption of Ukraine's grain exports.
Under the agreement, Turkey is hosting a joint centre where Russian, Ukrainian, Turkish and United Nations representatives will work to ensure the safe transit of Ukraine's exports to world markets.
Turkey depends heavily on Russia and Ukraine for grain. Russia accounted for 56% of Turkish grain imports in 2021 at $2.24 billion, while imports from Ukraine amounted to $861 million
Turkish Bayraktar drones sold to Ukraine played a prominent role in slowing the advance of Russian forces when they pushed into Ukrainian territory in February.
But Turkey also has growing defence ties with Russia.
It bought Russian S-400 missile defence batteries in 2019 and has suggested it could buy more, angering Washington which cancelled the sale of U.S. F-35 fighter jets and sanctioned Turkey's defence industries.
Erdogan said last year Turkey was considering more joint defence industry steps with Russia, including for fighter jets and submarines.
RIVALS IN WAR
In Syria, Turkey backs fighters who once appeared close to toppling President Bashar al-Assad, until Russian intervention shored up the Syrian leader and helped drive the insurgents back to a small pocket of northwest Syria on the Turkish border.
In February 2020, when an air strike killed at least 34 Turkish soldiers, Turkey poured reinforcements into the northwestern Idlib region to stall advances by Russian-backed Syrian government forces which had displaced 1 million people.
Erdogan says Turkey plans another incursion into northern Syria targeting areas controlled by Syrian Kurdish YPG fighters, drawing criticism from Russia, Iran and the United States.
In Libya, Turkey's military intervention turned back an assault on the internationally-recognised government in Tripoli by eastern-based forces who were supported - according to United Nations experts - by fighters from the Russian Wagner Group.
In Azerbaijan, Turkey supported a military assault to drive ethnic Armenian forces out of much of the mountainous Nagorno-Karabakh enclave in the south Caucasus - a region which Russia considers part of its sphere of influence.
Russian natural gas made up 45% of import-dependent Turkey's gas purchases last year, which hit a record level as a result of drought and a related rise in gas-driven power production.
Russian nuclear conglomerate Rosatom is also building a nuclear plant at Akkuyu in southern Turkey, which Putin has said will start working next year.
The plant is expected to provide up to 10% of Turkey's energy needs and will continue to be operated and managed by Rosatom for several decades.
Seven million Russian tourists visited Turkey in 2019, the largest number from any country, before the coronavirus pandemic drastically cut foreign travel. Tourism remains a significant source of hard currency for the Turkish economy.
Putin and Erdogan have led their countries for two rollercoaster decades.
In 2015 Turkey's military shot down a Russian jet which crossed into Turkish air space, prompting a crisis in relations. But less than a year later, Putin was one of the first world leaders to express support for Erdogan when he survived a coup attempt, laying the foundation for their growing defence ties.
Both, however, have kept each other waiting at summit meetings, prompting media speculation about games of one-upmanship. Erdogan was left waiting for two minutes by Putin in 2020, only for the tables to be turned in Tehran last month.
"Was it revenge?" asked Turkey's T24 website in a headline.
(Reporting by Dominic Evans; Editing by Christina Fincher)