Turkey's prime minister recently said that if asked to choose between Islamic State or Syrian President Bashar Assad, "we cannot choose either of them. They both need to go."
Yet, in recent days, Turkey and Russia, a prime Assad ally, have signaled they've reached a bit of a rapprochement and even some agreement about Syria.
Turkish Foreign Minister Mevlut Cavusoglu, in an interview with Turkish state news operator Anadolu, said that his government and Russia "have similar views on the ceasefire in Syria, humanitarian aid and finding a political solution."
After a high-level Turkish delegation visited Moscow to discuss the Syrian crisis, Cavusoglu said there were "some disagreements" on whether Assad should remain in power. But he noted, "instead of criticizing each other on this matter, we should search for possibilities to bring our dialogue closer," according to a report by Russian state news agency TASS.
The statement followed a flurry of conciliatory gestures by the government in Ankara in recent months to Russia and other nations, including Israel.
At a news conference in St. Petersburg, Russia, on Tuesday, Turkish President Recep Tayyip Erdogan apologized for Turkey's downing of a Russian warplane last year on the Syrian border and referred to Russian President Vladimir Putin as his "dear friend Vladimir."
It's unclear where the talks between Turkey and Russia will lead, but one certainty is that tensions between Turkey and Syria are unlikely to abate. Here is an overview of how those tense relations with Syria have developed:
For years, there was no love lost between Turkey and Syria. Water and territorial disputes, Turkey's Cold War alignment with NATO versus Syria's ties to the Soviet Union, and Arab nationalist resentment from centuries of Ottoman rule over Syria until World War I all made for a poisoned atmosphere.
But it was Syria's harboring of Abdullah Ocalan, founding member of the Kurdistan Workers Party (PKK), which almost brought the two countries to war.
Ankara had fought with the PKK, which seeks an independent Kurdish state, for decades. A confrontation between Syria and Turkey was narrowly avoided when Syria expelled Ocalan in October 1998 and signed a treaty recognizing the PKK as a terrorist organization. Ocalan was later captured by Turkish forces and convicted of treason; he remains imprisoned.
The expulsion of Ocalan laid the groundwork for the thaw that took place in 2002 when Turkey's Justice and Development Party came to power under then-prime minister — and now president — Erdogan. He spearheaded a "zero problems with neighbors" policy and reached out to Assad, who was seeking ways to break his diplomatic isolation.
Turkish investment and goods flooded Syrian markets, especially after a free-trade agreement came into effect in 2007. Joint Turkish-Syrian army exercises were held in 2009, and Erdogan took on the role of mediator in unofficial peace negotiations between Syria and Israel.
Bilateral trade volume had increased from $796 million in 2006 to $2.5 billion in 2010, according to figures provided by the Turkish government.
Also in 2010, both countries invited Lebanon and Jordan to create the "Levant Quartet," aimed at fostering economic and cultural integration and introduced visa-free travel among its members. The deal led Turkey's Hurriyet newspaper to hail Turkish-Syrian relations as "a model partnership in the Middle East."
Then came the Arab Spring uprisings of 2011.
As reports emerged of Syrian government forces using deadly violence against anti-government protesters, Erdogan described Damascus' actions as "savagery" in a June 2011 interview with Turkish news outlet Dunya Bulteni. Two months later, he dispatched his foreign minister at the time with a stern message for Assad, that Erdogan had "run out of patience."
By November 2011, Erdogan had fully sided with the opposition against Assad.
"We will continue to display the necessary stance," Erdogan said. "I believe that the Syrian people will be successful in their glorious resistance."
Erdogan's stance included opening Turkey's border for refugees fleeing Syria. But the move also opened the door for anti-Assad rebels, allowing them to transform much of the 500-mile Turkish-Syrian border into a staging ground for operations against the Syrian army.
Then Ankara went further, supplying the rebels as early as 2013 with arms. It also organized international support for the opposition through a logistics hub staffed with intelligence operatives from a number of countries, including the U.S.
As hardline Islamists began to dominate the anti-Assad opposition, Turkish border officials turned a blind eye to would-be Islamist militants who traveled to Turkey before crossing the border to fight Assad's forces. Bearded men sporting military clothing became a regular sight in airports in southern Turkey.
The assistance led to a major withdrawal of Syrian government forces from the country's northern provinces in 2013.
Policy analysts and leaders in the region, including Jordan's King Abdullah, have said the Turkish government's policies contributed to the resurgence of Islamic State. In 2014, the group overran large swaths of territory in Iraq and Syria, spurring the U.S. to forge a coalition to stop its advance.
But the Syrian civil war also provided an opening for Syria's Kurdish population, which took advantage of the power vacuum to create self-governing cantons in Kurdish-dominated areas of Syria under the control of the Democratic Union Party and its militia.
Kurdish control of Syrian territory worries Ankara, which believe such an entity will inspire its own restive Kurdish population to pursue separatist designs.
Concern about the Kurds is one of the few issues uniting Turkey and Syria.
In June, a senior official with Erdogan's party told Reuters that Assad does not support Kurdish autonomy. "We may not like each other," he said, referring to Syria and Turkey, "but on that we're backing the same policy."
The future of Assad, however, is another matter.
Although Ibrahim Kalin, Erdogan's spokesman, told the Russian TASS news agency on Aug. 4 that Turkey has always sought "opportunities for cooperation with Russia" on the Syrian crisis, Turkey can only do so much while the Assad government controls Syria.
"Unfortunately," he said, "as long as Assad is in power, it is hardly possible to talk about the political transition."
Bulos is a special correspondent.