The results of the meeting between Presidents Donald Trump and Vladimir Putin during the G-20 summit in Hamburg, Germany, which produced an agreement for a cease-fire in southern Syria, is therefore likely to have been met with unease in Ankara.

Turkey’s problem, however, is that although Washington and Moscow are global rivals, they concur on issues in Syria that Ankara is touchy about. This has raised the specter of an agreement between the United States and Russia that disregards Turkey’s vital interests in Syria.

Turkey has vacillated between the United States and Russia in an attempt to bolster its weak position in Syria. This approach has also been predicated on US-Russian ties being strained — as they were recently after the United States downed a Syrian fighter jet.

Ankara, whose own involvement in the crisis is marked mostly by failures due to a series of miscalculations, has found itself forced to engage in delicate balancing acts with the principal players in the crisis.

The Syrian crisis has taken many unexpected turns since 2011. The involvement of local and global powers has not only complicated matters but also produced unwanted results for neighboring countries such as Turkey and Iraq.

Should Russia and the United States arrive at a similar understanding in northern Syria, this could further weaken Ankara’s position in the region where both superpowers are cooperating with the Syrian Kurds to differing extents.

Ankara’s concerns in Syria today have boiled down to one specific issue, namely rolling back the political and military gains secured by Syrian Kurds attached to the Democratic Union Party (PYD) and its military wing, the People's Protection Units (YPG).

Turkey says the PYD and the YPG are terrorist organizations linked to the Kurdistan Workers Party (PKK), which has been waging a separatist campaign in Turkey for over 30 years. Turkey's efforts went unheeded when it tried to get Washington to dump the YPG just as the US-sponsored Syrian Democratic Forces, mostly comprising YPG fighters, were preparing to liberate Raqqa from the Islamic State (IS).

This situation forced Turkish officials to veer toward Russia in hopes that they could get more out of Moscow in terms of their demands in Syria.

The Russian side has responded warmly to Turkish overtures, given the opportunity these offered for driving a wedge between NATO allies. Moscow also invited Turkey to participate in the Astana process, which also includes Iran, and aims to start a new track to end the Syrian crisis.

If this effort succeeds, though, it will clearly be more on Moscow’s terms than Ankara’s.

Russia, with its unwavering support for Syrian President Bashar al-Assad, has, in fact, been an obstacle for Turkey in Syria from the start. It has not backed Ankara’s effort to keep the Syrian Kurds at bay either.

This became apparent in January, after the first Astana meeting, when Moscow circulated a draft constitution for Syria, much to Ankara’s annoyance, which also proposed autonomy for Syrian Kurds.

Russia also deployed soldiers to Afrin, near the Turkish border, in March in response to indications that Turkey was preparing a military operation against the YPG-held town.

Russia also disapproved of Turkey’s bombing of YPG targets in Syria in April, saying that “such moves trigger most serious concern in Moscow,” adding, in case the message was not received, that Russian officials were “talking about actions by the Turkish military against Kurdish forces.”

Russia refuses to list as a terrorist group not just the YPG, but also — unlike the United States — the PKK, and has allowed the PYD to keep a representative in Moscow.

Despite these anomalies for Turkey, Ankara does not want to risk another breakdown with Russia, such as the one that followed its downing of a Russian jet in November 2015.

Russia’s retaliatory economic sanctions, and the fact that Syrian airspace was effectively closed to Turkish jets by Moscow after that incident, proved unsustainable for Turkey. President Recep Tayyip Erdogan was forced to swallow his pride and eventually apologize to Putin for the downing of the Russian jet to get ties back on track.

A senior Turkish diplomat, who spoke on condition of anonymity due to his active position in the Foreign Ministry, told Al-Monitor that it would be naive to argue that mistrust between Ankara and Moscow has evaporated.

“Unresolved issues relating to Syria remain. But we are not prepared to let these undermine ties, and we are trying to resolve existing differences through diplomatic channels,” he said. He also denied that Ankara was playing Moscow and Washington against each other.

Erdogan said much the same in a July 5 interview with the German Zeit newspaper when asked if he trusted Trump or Putin more.

“Don't make us make such a choice! … We develop our relations to America as best we can, and we do the same with Russia,” Erdogan said. “Every country in the world pursues its interests. As do we, of course.”

Al-Monitor’s Metin Gurcan has reported on bargaining between Ankara and Moscow within the context of the de-escalation zones in northern Syria proposed in May at the Astana talks. These are said to involve a trade-off between Kurdish-controlled Afrin and nearby Idlib, which is controlled by the Turkish supported Free Syrian Army and various radical Islamic groups.

Retired Ambassador Unal Cevikoz, however, believes the chances of Ankara and Moscow agreeing on this score are slim. “The whole world knows that the Damascus regime wants to clean up Idlib,” Cevikoz wrote for Hurriyet, going on to suggest that Moscow was more likely to act with Damascus than Ankara in the end.

Meanwhile, US Secretary of State Rex Tillerson, who was in Istanbul earlier this week to attend the World Petroleum Congress, where he also met with Erdogan, acknowledged that not all is well in US-Turkish ties.

“I think we’re beginning to rebuild some of that trust that we lost in one another; they lost our trust to a certain extent, we lost theirs, so I think we are working very hard to rebuild that level of trust and that is the basis for any relationship,” Tillerson said in an address to American diplomats based in Turkey.

Washington, however, has given no indication that it will comply with Ankara’s demands regarding the YPG.

Meanwhile, some prominent pro-government analysts such as Hurriyet’s Abdulkadir Selvi have started to argue that strains with the United States in particular and the West in general are coming at a cost to Turkey.

“Turkey’s fight with the West is also affecting Ankara’s ties with the Islamic world, whose strings the West holds in its hands,” Selvi wrote. As an example, he pointed to Ankara’s latest divergence with regional Sunni powers over Qatar.

Referring to last year’s failed coup, whose first anniversary will be commemorated this weekend, Selvi also claimed that this attempt would never have taken place if Turkey’s ties with the United States had been good. “We have to improve our ties with the West,” he said. “The present state of affairs is unsustainable.”

Given its proven inability to draw the necessary lessons from its foreign policy failures and its continuing insistence on failed policies, Ankara is unlikely to change course at this stage.

This leaves it with few choices. One of these appears to be maintaining the present course in the hope that either Washington or Moscow will eventually support Turkey in Syria, especially with regard to the Kurds, because the United States' and Russia's global rivalry will force this on them.

This will most likely turn out to be a futile expectation, though, leaving Ankara to face its regional demons on its own, to the best of its limited capabilities, against increasing odds.