ANKARA (AFP) - Accused of harbouring links to the Islamic State in Iraq and Syria (ISIS) group in the past, Turkish President Recep Tayyip Erdogan risks paying a high price for his new get-tough strategy against the militants blamed for the Istanbul airport attack, observers say.
Although no group has yet claimed Tuesday's gun and bomb attack which killed 42 people, Ankara has pointed a finger at ISIS, which has been blamed for several suicide attacks around the country in the past year.
On Thursday, 13 suspected ISIS members were arrested over the bloodshed.
Turkey's opposition has accused Erdogan, whose Islamic-rooted Justice and Development Party (AKP) has been in power since 2002, of creating a climate which favours the extremism now stalking Turkey.
"Turkey is currently fiercely fighting ISIS - but its past mistakes have had fallout," says Sinan Ulgen, president of the Istanbul-based Centre for Economics and Foreign Policy Studies (Edam) and a former diplomat.
Ulgen sees Turkey as highly exposed to attacks owing to its shared border with Syria and Iraq, where ISIS controls swathes of territory, and the proliferation of ISIS cells on its own soil.
"Turkey is easy terrain for ISIS operations - much easier than Europe," says Ulgen.
At the start of the Syrian conflict, Turkey took a relatively indulgent approach towards the militants, with whom it shares a key goal: ousting the regime of Erdogan's arch-enemy Syrian President Bashar al-Assad.
Turkey also saw the extremists as a potential bulwark against Syrian Kurds, whose separatist ambitions have emboldened Kurdish rebels acting within Turkey's own borders.
The Turkish media has been awash with reports of militant recruitment drives in Turkish cities, including Istanbul, and extremist fighters being treated in public hospitals in southeast Anatolia, a region bordering Syria.
What brought about a sea change in Turkey's policy towards ISIS was last October's double suicide bombing in central Ankara - Turkey's worst ever attack - which killed 103 people.
The massacre rang alarm bells for Turkey's shocked leaders and highlighted their previous ambivalence towards extremists.
The attack also prompted Turkey to take an active role in the US-led international coalition to combat ISIS.
Since then, the authorities have regularly reported arrests or shootings during the dismantling of terror cells around the country and during attempts by suspected ISIS members to cross from Syria, some wearing explosives belts.
According to the interior ministry, the authorities have made some 4,000 ISIS-linked arrests. But that has not been enough to tamp down extremism in a majority Muslim, yet officially secular, country straddling Asia and Europe.
Secularist have condemned Erdogan for pushing an increasingly conservative religious line.
"The capacity of ISIS and similar Sunni militant groups in Turkey is set to grow as long as the country allows political Islam in the hinterland to grow unfettered," said Ege Seckin, analyst with IHS Country Risk.
Seckin warned that "the semi-autonomous and non-hierarchical nature of IS cells in Turkey", which the intelligence services estimate to include some 3,000 Turks, makes it difficult to detect them before they act.
"It is clear we must be ready to face new attacks," Deniz Zeyrek, Ankara bureau chief at Hurriyet daily, warned this week.
The opposition daily Cumhuriyet warned that students from universities in Ankara and Istanbul who hail from disadvantaged areas were being preyed on by jihadist recruiters.
The political opposition has rounded on the government over the attacks.
"Those who show themselves to be tolerant of, and even complicit in terrorism cannot combat it," Selin Sayek Boke, spokeswoman for the main opposition Republican People's Party said after the airport attack.
"AKP leaders had refused to classify ISIS as a terrorist organisation, they are responsible for this massacre," Boke accused.