The Syrian Civil War meets all of the standards for a foreign-policy nightmare, a pitch-perfect example of a quagmire that involves dozens of armed factions and foreign interlopers using human beings as pawns in their plots for power grabs and territory expansion. Alliances shift on a day-to-day basis as it is not uncommon for two factions to team up one day against a third opponent, and then fight each other the next. Syria is a nation slowly cannibalizing itself.

In these circumstances it may seem odd that foreign intelligence services align with one another on one matter, while simultaneously undermining each other in another area. The truth is that the realpolitik behind international politics makes these types of arrangements more common than you might think. America’s alliance with Turkey is a perfect example of a logical but dysfunctional relationship.

The United States needs Turkey as a staging ground to fight ISIS. The airbase in Incirlik has provided a hub from which America has launched fighter aircraft to fly sorties over ISIS-held territory. It has also served as a logistical resupply point for JSOC and Special Forces elements inside Kurdish Syria, a region known as Rojava, not to mention as a foothold in Turkey from which U.S. Special Forces soldiers, disguised in Turkish military uniforms, have been training the so-called New Syrian Army, a program funded by the CIA. So basically, US Special Forces soldiers get to man a failed CIA program watching the Turkish military train terrorists. Suffice to say, there is extreme frustration amongst the soldiers involved in this program.

The New Syrian Army, America’s latest failed proxy force.

Outwardly, Turkey is allied with the United States in the fight against ISIS. In reality, Turkey sees the Kurdish forces in northern Syria as a bigger threat than the Islamists. Turkey has long struggled with Kurdish separatism along their southern border, a struggle Erdogan has perpetuated in order to distract domestic politics away from his own tribulations. More specifically, the election of the Kurdish HDP party member to parliament spoiled Erdogan’s chances at altering the Turkish constitution and installing himself as president for life.