Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Turkey's abrupt decision to jump into the fight against ISIS with airstrikes should have been a win for the U.S. — but the package deal that came with the operations has put its allies in a pickle.

ISIS has not been the sole target of Ankara's freshly-launched firepower: Turkish warplanes have also started bombing Kurdish fighters linked to very forces battling ISIS. How is it, then, that Turkey is fighting both sides of the same war? It's complicated.

Turkey's initial lack of enthusiasm to the anti-ISIS coalition was not well received: The key U.S. ally boasts NATO's second-largest army and a crucial geographic position, sharing long borders with Syria and Iraq.

While Ankara had until last week been prioritizing unseating Syrian President Bashar Assad over direct engagement in the war against the Sunni militants, that policy shifted in wake of a deadly ISIS attack in the Turkish city of Suruc.

The timing of Ankara's about-face on ISIS engagement, however, has raised questions over whether defeating the extremists was merely a pretext to advance Turkish President Recep Tayyip Erdogan's political agenda.

That's because while Turkish warplanes were striking ISIS targets in Syria, they were also bombing camps in northern Iraq belonging to the Kurdistan Workers' Party, or PKK. Those moves effectively nullified a shaky 2013 cease-fire between Turkey and the group which has waged a 30-year insurgency.

Erdogan has offered a simple and resolute explanation for the simultaneous strikes: ISIS are terrorists and the PKK are terrorists. Strictly speaking, the U.S. and European Union also consider the PKK a terrorist organization.

"It's easy to enter a war but very challenging to get out of one"

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

But while Turkey has drawn no distinction between the threats — calling a rare emergency meeting at NATO headquarters on Tuesday to discuss both — it's not so simple for the U.S.

The PKK has ties to the U.S.-backed Kurdish militias fighting against ISIS in northern Syria and those fighters — known as the YPG — have been instrumental in reclaiming ISIS-held territory.

“It's a mess," said Fadi Hakura, a Turkey analyst at the London-based Chatham House think tank. "The YPG is an ally of the U.S. but a foe or enemy of Turkey."

That has left the two allies with opposing interests in the same war and puts the U.S. in a compromising position: ensure and cultivate Turkey's participation in the anti-ISIS coalition without alienating one of the few reliable allies it has in northern Syria.

“It’s a very, very delicate and complex balancing act that the U.S. will need to undertake to keep Turkey on side in the fight against the Islamic State while continuing military cooperation and coordination with the YPG in northern Syria," Hakura said.

Further complicating matters is that every gain for the YPG — a positive for the U.S. — sounds alarm bells for Turkey.

Turkey is home to the largest Kurdish population in the region and Ankara has been wary of Kurdish aspirations for an autonomous state since the collapse of the Ottoman Empire.

Ege Seckin, a Turkey analyst for IHS Country Risk, said that the Turkish government is “wired” to perceive recent Kurdish successes and territorial gains elsewhere as a threat in case momentum builds.

The prospect of Kurdish attempts for autonomy rank higher on the threat scale than ISIS to the Turkish government, Seckin added.

A missile-loaded Turkish air force warplane takes off from the Incirlik Air Base near Adana on Tuesday. Emrah Gurel / AP

"Turkey's interest is to fight the PKK," Seckin said. "ISIS is at most a secondary concern from Turkey's point of view."

That fundamental disagreement in threat perceptions could stymie the effectiveness of efforts to combat ISIS in northern Syria — an undoubtedly major concern for the U.S. but potentially less so for Turkey.

That's why speculation is rife that Erdogan may have taken advantage of the ISIS issue — and the U.S. commitment to contain the militants — to advance a competing objective.

Some analysts suspect Turkey might have agreed to attack ISIS on condition of U.S. support for a "safe zone" along the Syrian border in a strip of territory controlled by the militants and other rebel groups. To Turkey, such a safe zone would further the aim of toppling Assad and prevent Kurds from establishing a contiguous state.

Domestic politics also could figure in heavily. Erdogan's party lost its simple majority in parliament in June's inconclusive elections — and Turkish Kurds' main political party saw major gains.

Whatever the ultimate motives and moves to come, experts like Hakura say Erdogan could be playing with fire.

“It’s a very dangerous game,” Hakura warned. “It's easy to enter a war but very challenging to get out of one.”