The unexpectedly quick expansionism of the radical Islamic State in Iraq and the Levant (known as ISIS) in Iraq heralds the beginning of a new downward spiral in the Middle East, with significant political and security challenges for the established states of the region. At the top of the list is Turkey, whose consulate in the northern Iraqi city of Mosul was attacked and 45 of its diplomatic staff taken hostage by the jihadist group.

The government in Ankara came under heavy criticism domestically for having failed to organize the repatriation of its diplomatic staff in time. The hostage crisis thus became yet another milestone in Turkey’s haphazard diplomatic track record since the Arab Spring erupted three and a half years ago. That record has been marked by an inability to fully and realistically assess regional undercurrents and develop policies to enhance the country’s influence.

Following the attack on its consulate, Ankara came also under fire for its past policies of nondiscriminatory assistance to a wide range of opposition groups in Syria, including militant Islamic groups such as ISIS. Critics claimed that Turkey had decided to support these groups believing that they would be instrumental in achieving the objective of regime change.

Over time, however, it became clear that despite the assistance the Syrian military opposition received from friendly governments such as those of Turkey and the Gulf monarchies, the opposition proved too fractured and too ineffectual to unseat the regime of Syrian President Bashar al-Assad.

From Ankara’s perspective, support for—or sometimes benign neglect of—these groups, including the militant Islamist ones, was the consequence of the international community’s refusal to intervene in Syria to end Assad’s rule. As a country exposed to security spillovers and human tragedies from Syria, Turkey had to resort to policies that would protect its own interests. That meant working more closely with the opposition groups that were more influential on the ground.

Now, Ankara’s past policies have become a liability. The more recent policy of selective support has drawn the ire of militant groups that have seen Ankara harden its position. This is essentially the context that explains the deliberate attack against Turkey’s diplomatic representation in Mosul.

But the hostage crisis is also affecting Ankara’s stance on the containment of ISIS. On June 18, the government in Baghdad requested U.S. support for an air strike to weaken ISIS militarily. In response to this call, U.S. President Barack Obama opted to emphasize the need for Iraqi Prime Minister Nouri al-Maliki to create an inclusive government to deal with Iraq’s core problems. Ankara supported Obama’s policy and declared its opposition to air strikes.

Yet Ankara will not be able to prevent an emerging coalition between Tehran and Washington. Turkey is therefore likely to witness a further expansion of Iranian influence in Iraq—this time with U.S. acquiescence.

Beyond dealing with its hostage crisis, Ankara is also being forced to reassess its position regarding Iraq’s territorial integrity. As a neighbor that has been criticizing the Maliki government for its sectarian policies, Ankara feels vindicated by the total collapse of Iraq’s army. In Mosul, almost 30,000 members of a U.S.-trained military failed to withstand the attack of perhaps 1,000 ISIS jihadists.

Such a dismal performance is linked to the corrosive impact of Maliki’s sectarian policies, which have failed to generate inclusive and representative institutions, including the army. So Ankara welcomed the linkage established by the Obama administration between the continuation of U.S. assistance and the end of sectarian policies in Baghdad. Indeed, the Turkish leadership perceives Maliki’s sectarianism as a real threat to Iraq’s territorial integrity.

Yet even if the Maliki government decides to change its approach, by now it may be too late to prevent the dismantling of Iraq’s unity. The Kurdish region has already enjoyed years of autonomy in the north of the country. In response to the challenge posed to Iraq’s stability by ISIS, the Kurdish leadership has started to hint at the feasibility of setting up an independent Kurdish entity.

Such remarks, especially in the wake of the takeover in early June of the critical province of Kirkuk by Kurdish fighters, would normally have raised alarm bells in Ankara. But since 2008, the gradual rapprochement between Ankara and the Kurdistan Regional Government (KRG) in Erbil has radically overhauled the relationship. Ankara now views the KRG as part of its economic hinterland. The conclusion of a set of ambitious energy agreements involving the export of oil and gas from the KRG to world markets through Turkey further solidified these ties.

So, paradoxically, despite having failed to settle its own Kurdish problem, Turkey might be the only country in the region not to react strongly against the emergence of an independent Kurdish entity. More than a decade after the U.S. intervention, Iraq is now firmly set to be the prelude for a chain of events with the potential to change the map of the region as we know it.