At present, no one in their right mind would say that the political environment in Turkey is in a good shape.

The uncompromising foreign policy practised by the Justice and Development Party (AKP) leadership has already done much to isolate the country, which currently does not have ambassadors in five countries in the Middle East.

Turkey ended up withdrawing its ambassadors from Yemen, Syria, Egypt, Israel, and Libya in different instances.

With the suspected Islamic State of Iraq and the Levant (ISIL) attacks last week in the Turkish border town Suruc, there are ominous signs that the widespread violence in Syria may spill over into Turkey.

Inside Story - Has Turkey bitten off more than it can chew?

The Suruc bombing, which claimed the lives of 32 people, targeted a group of activists campaigning to rebuild the nearby Syrian town of Kobane. The town was all but destroyed after an unsuccessful siege by ISIL last year.

This was not the first time that a suspected ISIL attack has struck Turkey. Two days before Turkey's pivotal June 7 elections, other suspected ISIL-linked individuals set off a bomb during a rally by the Kurdish-left wing Peoples' Democratic Party (HDP) in the southeastern city of Diyarbakir, causing four deaths.

Maintaining security in Turkey's southeast is a difficult task: Only a small stretch of Syria's border with Turkey, which is over 900km, is in the hands of forces loyal to the Syrian President Bashar al-Assad.

The rest is controlled by the other major players in the Syrian civil war: the Islamic Front, the Free Syrian Army, ISIL, and the armed offshoot of the Kurdish Democratic Union Party, People's Protection Units (YPG).

The Turkish government has publicly admitted its inability to stem the flow of jihadists and according to witness testimonies Turkish intelligence helped deliver weapons across the border to Syria. It has become clear what a serious oversight this was now that Turkey has been drawn into the conflict.


RELATED: Suspected ISIL bombing worries Turks


At present, only Turkey's southeast is directly affected by this conflict. However, major cities like Istanbul and Ankara as well as tourist magnets like Antalya may soon become targets.

The risk of retaliatory attacks by ISIL - whose numbers are estimated to comprise 700 Turkish citizens - is even greater now that Turkey has commenced air strikes against ISIL positions in Syria.

Changing tide

Just a few years ago, then Prime Minister Recep Tayyip Erdogan and Foreign Minister Ahmet Davutoglu were far more optimistic about Turkey's standing in the Middle East.

In a speech to parliament in April 2012, Davutoglu famously stated: "From now on, Turkey will direct the wave of change in the Middle East."

Shorn of its parliamentary majority after more than a decade in power, and ruling the country as a caretaker government, the AKP is facing an unprecedented set of crises.

 

Likewise, in September 2012, Erdogan announced that Assad would shortly be overthrown: "God willing, we will soon go to Damascus [...] and recite the al-Fatiha at the tomb of Saladin; we will perform our prayers in the Umayyad Mosque."

Erdogan and Davutoglu were convinced that the nations of the Middle East would undergo the same democratic transformation Turkey had experienced with the AKP's 2002 electoral victory.

However, very little went according to the party's plans. Syria has suffered a devastating four-year-long civil war, during which the AKP's Syrian protege, the Muslim Brotherhood, has steadily lost its base of support, leaving a vacuum that has been filled by ISIL and other jihadi groups.

ISIL now controls a large swath of territory in both Iraq and Syria.

And Turkey's recent elections resulted in the AKP losing its parliamentary majority, meaning that for the first time in 13 years, it cannot form a single-party government. The country has been run by a caretaker government for nearly two months, and the AKP must now form a coalition with one of Turkey's three opposition parties.

Fighting on two fronts

Amid this political uncertainty, the AKP must not only confront the threat of ISIL, but must also deal with its own Kurdish conflict.

Since 2013, the Turkish state has been in negotiations with Abdullah Ocalan, the imprisoned leader of the outlawed Kurdistan Workers' Party (PKK), in the hopes of ending the bloodshed and solving the Kurdish question once and for all.

However, the talks are currently at a standstill. The aforementioned YPG - which is linked to the PKK - controls a large area in northeast Syria, a de facto autonomous region known as Rojava.

Turkey tense amid air strikes on ISIL and PKK

This is a turning point for the PKK: From its beginnings as an armed organisation nearly four decades ago, it has become a quasi-state actor much like the autonomous Kurdish region in Iraq.

Turkey's own Kurds, who number in the millions, are not merely watching these developments from the sidelines.

Many of them are also crossing into Syria to join the YPG. The HDP, which is known to have ties to the PKK, doubled its votes in the recent election, surpassing the 10 percent electoral threshold and sending 80 MPs to parliament.

However, it will be impossible for the Kurdish political movement to consolidate its gains without a continued ceasefire. A serious escalation of hostilities would be catastrophic for Turkey, bringing the nation to the brink of civil war.

Last October, Turkey had a brief foretaste of this scenario, when Kurds rose up across the country in anger at their government's unwillingness to aid their brethren in Kobane against ISIL. The resulting street violence led to 35 deaths.


RELATED: Will Kurds be the decisive factor in fighting ISIL?


It now looks as though the ceasefire may have been effectively called off following Turkey's air strikes on PKK positions in northern Iraq on Saturday - just a day after launching air strikes on ISIL targets on the Syrian border.

The PKK has since responded with retaliatory attacks on Turkish security personnel, and has issued a statement declaring the ceasefire to be null and void.

Thus, the AKP government faces the prospect of waging war simultaneously against two different foes (who are are fighting each other), all while struggling to form a coalition with its political opponents.

Shorn of its parliamentary majority after more than a decade in power, and ruling the country as a caretaker government, the AKP is facing an unprecedented set of crises.

Its ability to retain the confidence of its electorate will depend on how successfully it can deal with these crises in the months to come.

To judge from Turkey's present turmoil, the AKP seems to be at a complete impasse both at home and abroad.

Behlul Ozkan currently teaches at Marmara University in Istanbul. His book, "From the Abode of Islam to Turkish Vatan" was published by Yale University Press in 2012.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.

Source: Al Jazeera