If Turkey continues to use its alliance with the US to ostensibly combat ISIS as a pretext for a war on the Kurds, it won't be surprising.

Turkey’s so-called war on the Islamic State of Iraq and the Levant (ISIL) has already made headlines. What many of these articles lack, however, is perspective on Turkey’s alleged U-turn from the context of that country’s foreign policy for the past 13 years.

Turkish foreign policy under the Justice and Development Party (AKP) has always had a strong domestic focus, which Carol Migdalovitz calls a “domestically-driven foreign policy.”  In the early 2000s Turkey’s unprecedented reforms toward EU accession aimed at securing the party against military interference. Similarly, Turkey’s support of the Muslim Brotherhood in Egypt and Syria was determined by the AKP’s ideological ties with Islamist parties, which actively fought secular regimes.

It was not until international pressure mounted that Turkey officially designated ISIL a terrorist group in 2013, but the reality on the ground was quite different. For instance, Turkey shipped weapons to Syrian Islamists under the guise of fighting the Assad regime. Ankara long denied the coalition fighting ISIL access to its air bases because those powers did not envisage fighting the Assad regime.

In June 2015, Turkey started advocating an incursion into Syria. The reason was not, of course, the ISIL threat. The Syrian Kurdish military units (YPG), which had been fighting ISIL, took control of nearly half the Syrian-Turkish border. This YPG victory signaled a double threat for Turkey, as it could lay the foundations of Kurdish statehood on Turkish borders and empower Turkish Kurds in their demands from the Turkish government.

Against this backdrop, the US sent a high profile delegation to negotiate united operations against ISIL on July 7 The US response was conditioned on its uneasiness with Turkish plans to attack Syrian Kurdish units—local US allies in the fight against ISIL. The negotiations were still ongoing when, On July 20, the ISIL terrorist attack in Suruc took the lives of 32 people and wounded more than 100. The attack was directed against Turkish Kurds headed toward the Syrian Kurdish town of Kobane. Two days later, the Kurdistan Workers’ Party (PKK) a Kurdish terrorist organization, killed two Turkish policemen, faulting the Turkish state for collaborating with ISIL.

There is no question that these terrorist attacks facilitated an agreement between the US and Turkey. On July 22, the US-Turkey deal was concluded by Presidents Obama and Erdogan. The press release issued by the Turkish Foreign Ministry stated the main points of this deal, which entailed Turkey opening its bases for the anti-ISIL coalition and joining said coalition. The deal also aims at “permanently ensuring and bolstering the safety of the inhabitants who now live in areas under DEASH (ISIL) control.”

In a hastily-published article in The Washington Post, Ahmet Davutoglu, Turkey’s prime minister, conveyed the threats posed to Turkey. From ISIL, to the Assad regime, to the PKK, he painted a picture of a Turkey under siege from all sides. The reality of Turkey’s actions, however, show other priorities. From 23rd to 26th July alone, Turkey’s attacks targeted nearly 400 PKK bases and only 3 of ISIL.

Thus, the deal between the US and Turkey is further complicated in light of the parties’ differing priorities and the numerous shifting variables on each side.

Turkish President Recep Tayyip Erdogan has always had his say on foreign policy. His personal whims have already spoiled Turkey’s relations with Armenia, Egypt, Serbia—contrary to the initiatives employed by Turkish diplomacy. In this case, stakes for Erdogan are higher than ever before. A crafty politician who has used the reconciliation process with the Kurds as a means of securing his power from election to election, he has faced the harsh realty of a potent pro-Kurdish Peoples’ Democratic Party (HDP) in the period since the 7th June election. That party gained nealry 80 seats in parliament, depriving the AKP of its absolute majority and challenging Erdogan’s ambitions of establishing a presidential republic.

Erdogan used the recent PKK attack on Turkish policy as a pretext for launching an all-out war on the PKK. He has endeavored to tarnish the HDP’s, depicting it as an outlet for terrorism. These claims have won him increasing support among nationalists. ISIL, on the other hand, appears to be the last of his problems. For some time, he refrained from calling them terrorists, claiming instead that real Muslims shall not kill other Muslims. Only in his 2014 UN speech was Erdogan forced to admit that ISIL is in fact a terrorist organization. In short, for Erdogan it’s about securing his hold on power.

The Turkish military and diplomatic establishment is the other stakeholder in this US-Turkey deal. The Turkish establishment is concerned about Syrian Kurds’ gains and the possible repercussions for Turkey. Thus, by making an incursion into Syria, Turkey will set up a buffer zone that is clear free of Syrian Kurds as well as the Assad regime, further hindering Kurdish consolidation and facilitating the operations of the Assad opposition.

For the third stakeholder, the US, access to Turkish bases is a tangible success. This will significantly improve the effectiveness of aerial operations. But there are still many stumbling blocks in the US-Turkey deal, and these will soon surface.

The details about the cleared zone between Turkey and Syria are still unclear. It is obvious Turkey opened its bases in exchange for this long-advocated “safe zone.” Turkish Foreign Minister Cavusoglu has said the zone must be created naturally. Turkish sources have given some information regarding the geographical details of the zone, while senior administration officials in the US have made it clear that there are no U.S. plans for a safe zone, a no-fly zone, an air-exclusionary zone, a humanitarian buffer zone, or any other protected zone of any kind.

There are additional contentious issues, including the “moderate” forces, whom the US and Turkey will help. Turkey is adamantly opposed to any assistance for Syrian Kurds, who have thus far been the only real force fighting ISIL. Ankara will likely advocate for local Turkmen forces and the Ahrar ash-Sham movement.

The paradox is that Turkey’s participation in the anti-ISIL coalition will probably be limited to airstrikes, and its “moderate” allies are still fragile, whereas Syrian Kurds are the only ground forces that have displayed vigor and ability in fighting ISIL. US diplomats will have a challenging time solving this dilemma.

In short, the outcome of this complex situation will depend on many variables: Erdogan’s war on Turkish Kurds; Turkey’s actions toward halting Syrian Kurdish gains; excluding Syrian Kurds from any US support; gaining US backing for a no-fly zone; dragging the US into a war against Assad; the US’s ability to include the YPG in these operations; avoiding direct clashes with the Assad regime; bringing Turkey into a real war on ISIL; and of course securing the consent of Moscow and Tehran—the patrons of the Assad regime.

If the US is able to get Turkey to truly join the fight against ISIS, it would be an exceptional success for the Obama Administration, given that Turkey has previously avoided military operations in Afghanistan and Libya because they targeted fellow Muslims. If Turkey skips the real war and develops a new modus operandi with ISIS, however, no one will raise an eyebrow.