ISTANBUL, Turkey — As tens of thousands of refugees flee the latest ISIS advances, Kurdish politicians in Turkey are accusing Ankara of helping the so-called Islamic State in its blitzkrieg through neighboring Syria.

The accusations echo concerns both inside and outside Turkey that the government of President Recep Tayyip Erdogan has tolerated extremist groups in Syria in the hope that their fighters would speed the downfall of Syria’s president, Bashar al-Assad. But at the same time in a region of confused alliances where it’s increasingly obvious the enemy of your enemy is not necessarily your friend, Ankara has undermined American efforts to build an anti-ISIS coalition.

The fresh allegations against Erdogan came on the same day that he revealed “diplomatic and political bargaining” with ISIS had freed 46 Turkish and three Iraqi hostages that had been in the hands of the extremists since June. ISIS itself said Turkey had promised not to take part in a U.S.-led coalition that is preparing military strikes against the militants in Syria.

Takva Haber, a Turkish website that often reflects ISIS thinking, said the order to release the Turkish hostages had come directly from ISIS leader Abu Bakr al-Baghdadi. “A phase of negotiations, held basically between two states,” had led to the outcome, the website said.

Recognition of ISIS or ISIL as a “state” at any level or in any form is precisely what al-Baghdadi is looking for and U.S. President Barack Obama vehemently opposes.

“ISIL is certainly not a state,” Obama said this month. “It is recognized by no government, nor by the people it subjugates. ISIL is a terrorist organization, pure and simple. And it has no vision other than the slaughter of all who stand in its way.”

Takva Haber begs to differ. Through the hostage negotiations, Turkey had indirectly recognized the ISIS “caliphate,” it said, and suggested that the hostage release was a quid pro quo for Turkey’s refusal to aid the anti-ISIS alliance. “The state of the Turkish republic has taken a stance against a new occupation [of Syria and Iraq] by rejecting participation in the U.S. occupation coalition.”

Erdogan has insisted that no monetary ransom was paid, but he confirmed on Sunday that Turkey’s intelligence service did negotiate with ISIS. Speaking to reporters in Ankara, Erdogan said there were critics accusing Turkey of bargaining with ISIS. “If they are referring to financial bargaining, this is out of the question,” he said. “But if they are referring to a diplomatic bargaining, of course we are talking about a political, diplomatic bargaining. This is a diplomatic victory.”

“Diplomacy” is not normally a word associated with terrorist hostage negotiations.

The Turkish president did not give details about the substance of the arrangements between Turkey’s MIT intelligence service and ISIS. But Emre Uslu, a columnist for the Taraf newspaper and a prominent Erdogan critic, has listed several possible Turkish concessions to ISIS. Among them: Ankara might have assured ISIS that Turkey would not take part in a military campaign against the jihadists, or might have promised help for ISIS’s fight against Syrian Kurds.

In recent days ISIS forces have rolled through dozens of mainly Kurdish towns and villages in northeastern Syria. Turkey’s disaster relief agency said on Sunday that in recent days around 100,000 Syrian Kurds had crossed the border near the Syrian town of Ayn al-Arab, known as Kobane in Kurdish. News reports said ISIS fighters were advancing toward Kobane through surrounded villages and were about 10 miles from the town on Sunday.

Kobane is part of an unofficial autonomous region near the Turkish border carved out by Kurds in the power vacuum of the Syrian civil war. ISIS is trying to defeat the Kurds in the region, known as Rojava, and consolidate its own position near the border, where some areas are already under the control of the self-styled “caliphate.” (Smuggling diesel into Turkey is a major source of ISIS revenue.)

The main Kurdish militia in Rojava is the Democratic Union Party (PYD), an offshoot of the Turkish-Kurdish rebel movement known as the PKK. According to news reports, the PKK has sent several hundred fighters from Turkey to Syria to help the PYD against the jihadists.

On Sunday, Turkish security forces blocked Kurds from crossing the border from Turkey into Syria, triggering violent clashes and fresh accusations of cooperation between Turkey and ISIS. Referring to Erdogan’s ruling Justice and Development Party (AKP), Zubeyde Zumrut, a Kurdish politician from Diyarbakir, Turkey’s main Kurdish city, told a rally on Sunday that “ISIS equals AKP and AKP equals ISIS.”

Kurdish politicians in Turkey say the Ankara government is concerned Kurdish autonomy in Rojava could lead to similar demands on the Turkish side of the border. “We have seen that the state does not help,” says Aysel Tugluk, a Kurdish lawmaker in Turkey’s parliament. She said Ankara should understand that Kurdish autonomy like that practiced in Rojava was actually good for Turkey’s national security, but that helping ISIS was not. “Whoever supports ISIS today could become the target of ISIS attacks tomorrow,” she said.

Ayla Akat Ata, another Kurdish deputy in parliament in Ankara, said she had received reports saying that arms supplies for ISIS had crossed the border from Turkey into Syria by train. She said the weapons were meant for ISIS troops involved in the onslaught on Rojava. Ata wants the government to state officially whether the reports are true or not. There has been no reply yet.

Before Erdogan left for the U.N. General Assembly in New York, where he is scheduled to hold talks with Obama and other leaders, he said on Sunday that his government was helping all refugees coming across the border from Syria and Iraq, regardless of ethnicity or religion. Turkey has already taken in about 1.2 million Syrians and is struggling alongside the U.N. Refugee Agency to care for the new arrivals near Kobane.

Erdogan said he and Obama had discussed the idea to create buffer zones within Syria to house and feed refugees there. The Turkish military has been working on plans for the buffer zones, but it remains unclear whether Turkey itself would take part in securing the areas militarily. Erdogan said on Sunday that the danger to the Turkish refugees had prevented him from accepting demands by Turkey’s western allies for support for the anti-ISIS alliance that Obama wants to forge. But he did not say whether this position would change now that the hostages are free.

Ziya Meral, the Turkey analyst at the Foreign Policy Centre, a think tank in London, told Al-Jazeera that Erdogan was unlikely to opt for a more active role for Turkey in the movement against ISIS. He said Turkey was expecting the U.S. to come up with a plan for the future of Syria and Iraq once ISIS was defeated militarily. “It would be rather naïve to anticipate Turkey to start partaking in a public campaign against ISIS without a robust plan as to what will happen next,” Meral said.