Before the conflict in Syria started, Turkey had close ties with the Assad regime. The two countries lifted visa requirements, held joint military exercises and cabinet meetings, and cooperated against the Kurdistan Workers’ Party (P.K.K.). Ankara’s newly-embraced idea, “zero problems with neighbours,”- the brainchild of Turkish foreign minister, Ahmet Davutoglu- had (at the time) won praise both at home and abroad. But the conflict in Syria altered all that. Once a success story of Turkey’s new policy; Syria is now Ankara’s biggest foreign policy headache, while Davutoglu has long become a recluse in government circles.

The conflict in Syria forced a turnabout in Ankara’s Syria policy six years ago. Turkey burned all bridges with the regime and became one of the main supporters of the opposition to Assad. But after years of backing the opposition, Turkey failed to bullock the conflict towards the trajectory it wanted. Instead, Turkey has ended up with 3 million refugees residing within its borders among the countless other problems stemming from the Syrian conflict. Now, Ankara is attempting another U-turn by quietly dropped its demand for regime change in Syria and gradually scaling back its support for the opposition.

This change has been in the pipeline for some time. In 2015, Turkey shifted its focus from regime change to counter-terrorism amidst domestic and regional developments. In the summer of 2015, ISIS struck a cultural centre in a Turkish town near the Syrian border, killing at least 30 people and wounding more than 100. It was the radical group’s first mass killing of civilians in Turkey and the worst spill over in deadly violence from Syria’s civil war. Several days later, a two-year cease-fire between Turkey and the P.K.K. collapsed. Simultaneously, the People’s Protection Units (Y.P.G.), the P.K.K.’s Syrian offshoot and a close U.S. ally in the fight against ISIS, captured border towns and began to link its disconnected cantons. All of these developments heightened Turkey’s perception of threat and forced Ankara to pivot its Syria policy toward counter-terrorism.

Russia’s military intervention in Syria and tattered ties between Ankara and Moscow after Turkey downed a Russian jet later in the year made Turkey’s single-minded regime-change policy even less possible.

In 2016, Turkey moved to repair ties with Russia while its relationship with its NATO partner, the United States, strained further. Washington’s cooperation with the Y.P.G. was already a bone of contention in Turkey-U.S. ties. The coup attempt added another layer to the tension when the United States refused to extradite Fethullah Gulen, a Pennsylvania-based cleric whom Turkey accuses of orchestrating the failed coup.

Turkey’s siding with Qatar after three Gulf countries and Egypt cut ties with Doha spelled more trouble for Ankara in Syria. Turkey’s stance angered the Saudis, whose Syria policy largely went hand-in-hand with Ankara’s. Taking advantage of the tension between Riyadh and Ankara, Syrian Kurdish officials took on an increasingly anti-Iran, pro-Saudi position. Ankara watched anxiously as what it saw as a Kurdish-Saudi axis emerged.

These developments together with the Trump administration’s decision to increase U.S. support for the Y.P.G. has incited Turkey to seek substitutes in its effort to check Kurdish advances in Syria. The reconciliation with Russia as well as Iranian discontent with the Y.P.G. have provided the opening Ankara has been looking for.

After years of fighting, Turkey now seems to have found mutual ground with the Assad regime and its allies in offsetting its arch enemy in Syria: the Y.P.G. This of course means a complete switch in Ankara’s Syria policy.

The loss of Aleppo proved to be a game-changer in the Syrian conflict. Ankara further assisted regime’s advances through the cease-fires it brokered with Russia between the regime and the opposition. The cease-fire in the west meant that the regime was able to free forces and break the ISIS siege of Deir Ezzor in the east, in what is considered as one of the most important victories for the regime.

Moreover, last month, Turkey cut salaries of members of the Istanbul-based Syrian National Coalition. The move is the latest in a political relationship tainted by a divergence of interests between Ankara and the Syrian opposition. Many in the opposition begrudge what they see as Turkey’s tilt toward the regime and its allies to restrain Kurdish advances.

Even though Turkey’s policy change is a big setback to the opposition, it does not mean Ankara is back to zero problems with President Bashar al-Assad, at least not yet. For that to happen, Ankara and Damascus have to see agree on the topic of the Syrian Kurds. If Assad chooses to no longer tolerate Kurdish autonomy, President Erdogan may once again have “zero problems with Assad.”

The writer is a LUMS and University of Warwick Alumnus. She is currently a Research Fellow at the Institute of Strategic Studies Islamabad (ISSI).