As Islamic State of Iraq and the Levant (ISIL) fighters surround the Syrian-Kurdish enclave of Kobane on three sides and civilians flee en masse toward the tightly sealed border with Turkey, Ankara sees an opportunity: Much-needed ground reinforcements to save Kobane will have to either come from or transit through Turkey, which may be able to leverage its long-awaited participation in the U.S.-led coalition against ISIL for its own purposes.

Despite considerable misgivings about bailing out Kobane’s ruling PYD — the armed sister party of the Turkish-based Kurdistan Workers’ Party (PKK) insurgency, which Ankara and Washington both regard as a terrorist organization — the brutality that many fear would ensue if the town of 40,000 falls to ISIL has put Ankara under humanitarian and political pressure to send in troops. U.S.-Arab airstrikes have not been enough to boost the struggling Kurdish ground forces, which have ordered an evacuation of Kobane and are desperately pleading for help.

The Kobane crisis has lent urgency to Ankara’s demands in the region, most of all from its allies in the U.S.-led coalition that is striking ISIL in Iraq and Syria. Turkey has accused the United States of focusing too narrowly on fighting the extremists, who have taken over about a third of Syria and swaths of Iraq, and of losing sight of the fight against Syrian President Bashar al-Assad, whose overthrow has long been Turkey’s top priority in Syria. In fact, Turkey has long been accused of tolerating ISIL — whose fighters often transit through Turkey en route to Istanbul — because the group was useful in countering both Assad and the Kurds.

Turkey’s parliament last week finally authorized the government to commit Turkish forces and military bases to the U.S.-led effort against “terrorist groups” in Iraq and Syria who “direct attacks against Turkey” — presumably meaning ISIL — but it is hesitant to sign on to a drawn-out campaign that might leave the Assad regime intact and empower the transnational Kurdish separatist movement. Ankara believes U.S. support for the “moderate” rebels fighting Assad has been paltry and that strikes will serve only to boost the regime unless a viable ground partner is created.

Speaking Tuesday at one of Turkey’s several Syrian refugee camps in the southern city of Gaziantep, Turkish President Recep Tayyip Erdogan told residents that Kobane was about to fall and seemed to name his terms for saving it. Turkey, he said, wants a more robust coalition strategy in Syria that includes empowering the moderate rebels and imposing a no-fly zone over Syria and buffer zone on the ground to help protect Turkey’s borders and stem the flow of refugees.

The Obama administration has long rebuffed those demands, unwilling to directly engage an Assad regime that poses little direct threat to U.S. interests. But according to Aron Lund, editor of the Carnegie Syria in Crisis blog and an expert on the Syrian war, Turkey realizes momentum has shifted as the ISIL threat rises.

“With the U.S. Air Force now operating inside Syrian airspace and the Turkish parliament having cleared the way for foreign forces on its soil, a no-fly zone is no longer the distant possibility it used to be,” he wrote.

Behind the scenes, Turkey might also be leveraging intervention on behalf of Syria’s Kurds in order to co-opt them in the fight against Assad. The PYD has taken advantage of a power vacuum in Kurdish territory to consolidate control over a now semiautonomous region, all but abandoning the nationwide rebellion against Assad. Since Syrian forces withdrew from Kurdistan in 2011, many in Syria have suspected that the Assad regime had even struck some sort of deal with the PYD to deflect its fire and concentrate efforts elsewhere.

“Turkey is using Kobane as an opportunity to convince the PKK to start fighting Assad,” said Soner Cagaptay, a Turkey expert at the Washington Institute for Near East Policy. “They’re saying, ‘Join us and we’ll back you up.’ This will be the cost of Turkish support.”

At the same time, Turkey views the Syrian war through the lens of its struggle to quell its Kurdish insurgency, which is based in the country’s southeast and has dragged on for more than 30 years. The Erdogan government is currently engaged in peace talks with the PKK — though there has not been evidence of much progress — and it has long been wary that Syrian Kurdish success would encourage the PKK to take a harder line in negotiations.

For those reasons, Turkey has kept a closed border with Syrian Kurdistan, even as the ISIL offensive in Kobane gained steam and many Turkish Kurds wanted to join the fight or distribute humanitarian aid.

In some ways, Kobane will be a litmus test for Turkey, which will have to decide which “terrorist” group it prefers to have as a southern neighbor: The PYD or ISIL, which already controls about half of Syria’s border with Turkey and poses a domestic security threat with a growing presence in certain Turkish cities.

“Right now the effect of Kobane has been to force the PKK to reconsider its role and to come to Turkey begging for assistance, so that Turkey can dictate its terms,” said Cagaptay of the Washington Institute. “But at the end of the day, there’s a fine line for this Turkish realpolitik. Can they really allow the loss of Kobane and become neighbor to [ISIL] for another 100 miles?”