After months of hesitation to take action against the Islamic State (ISIS) and almost two years of quiet since a 2013 truce with the Kurdistan Workers’ Party (PKK), Turkey decided to pick a fight with both. It has been pounding Islamic State targets in Syria and PKK positions in northern Iraq.

It all started July 20 when a Turkish student believed to have links to the Islamic State blew himself up among a group of mostly Kurdish peace activists in the border town of Suruc, killing more than 30 people. In retaliation for the bombing, a group claiming to have links to the PKK, which is holding the government responsible for not doing enough to prevent ISIS attacks, killed two Turkish police officers in the Kurdish town of Sanliurfa.

Turkey has responded by opening Incirlik Air Base for coalition strikes on ISIS and arresting hundreds of suspected members of both the Islamic State and the PKK. Ankara has lumped both campaigns together in a broad "war on terror," but both the air strikes and the arrests have mostly targeted Kurds.

Ankara’s response is aimed at undermining coalition talks, securing the nationalist vote ahead of potential early elections, undercutting the gains made by the pro-Kurdish HDP in the June elections, and preventing the Syrian Kurds from linking up the Kurdish enclaves in northern Syria.

In a huge blow to President Recep Tayyip Erdogan’s presidential dreams, the Justice and Development Party (AKP) lost its parliamentary majority in the June elections and was forced into coalition talks with opposition parties. But Erdogan is not ready to accept defeat. He has quietly been pushing for early elections with the idea that another round of polls could now serve him better. The country’s recent chaos might give Erdogan the advantage he seeks. The prospect of deeper involvement in Syria and a two-front war against ISIS and the PKK are likely to scare away potential coalition partners, paving the way for early elections.

Erdogan is hoping to recapture the nationalist votes that the AKP lost in June by cracking down on the PKK. After the killing of the two policemen, Erdogan issued a unilateral end to the cease-fire, declaring that it is “not possible to carry on the [peace] process with those [the PKK] who target our national unity and brotherhood.” The government’s hard-line response to the PKK has already won praise from nationalist circles that had declared that they would engage in coalition talks with the AKP only if the peace process ends.

Erdogan’s prime target seems to be the pro-Kurdish HDP that captured a historic 13 percent in the elections and dealt a blow to Erdogan’s ambition to acquire sweeping new powers. The uptick in the HDP’s percentage of votes came from conservative Kurdish voters who had traditionally voted for the AKP. In June they largely voted for the HDP to protest the government’s indifference to the suffering of their brethren in the northern Syrian town of Kobani. By escalating violence against the PKK, Erdogan is pressuring the HDP to pick a side. The HDP will either have to distance itself from the PKK and risk losing its Kurdish base, or step up its pro-Kurdish rhetoric and alienate the Turkish citizens who voted for the party due to its moderate stance.

Turkey has been uneasy about the U.S. collaboration with the PKK’s Syrian offshoot, the PYD, against the Islamic State. Particularly worrisome to Ankara has been the fall of Tal Abyad, a northern Syrian town under the control of the Islamic State, to the PYD with U.S.-led coalition air support. The capture of Tal Abyad linked two of the autonomous Kurdish zones in northern Syria, fueling Turkish concerns about Kurdish separatism in Syria that could encourage similar desires in its own Kurdish minority. By finally allowing the United States to carry out strikes against ISIS from Incirlik, Ankara hopes for a quid pro quo that will see the United States distance itself from the PYD.

But this is a high-risk game, and Erdogan’s plans might backfire. His embrace of nationalism might gain him nationalist votes, but it could also cost him the remaining Kurdish votes, further consolidating the HDP’s power among the Kurds.

And Turkey’s slide into chaos is already hurting the country’s fragile economy, which just in this brief spurt of turmoil has seen the lira fall by about 4 percent. The Islamic State is likely to retaliate for Turkey’s decision to open Incirlik by using its sophisticated network of recruits, safe havens, and smuggling routes in Turkey, plunging the country into further chaos and weakening support for the AKP.

Erdogan might not get what he wants from the United States, either. The Kurds have been the most effective fighting force against ISIS, and the United States is unlikely to dump them anytime soon. When asked about whether the coalition jets taking off from Incirlik will be helping the PYD forces in Syria, U.S. State Department Spokesperson John Kirby said, “[The PYD] have already benefited from coalition air support. The fact that we now have access to bases in Turkey will allow for that support to be timelier and perhaps even more effective. So I would expect that that kind of air support will continue.”

Turkey’s bombing campaign against the Kurds is likely to strengthen the Islamic State. The Suruc bombing was the latest reminder that ISIS poses a direct challenge to Turkey’s national security. Without the Kurds putting up an effective fight against the Islamic State, Turkey could be bordering a long stretch of territory under ISIS control.

Erdogan has embarked on a high-risk strategy to secure his political future, but it is the future of the country that is at stake. An all-out war with the PKK, coupled with a rising Islamic State threat inside its borders, could take the country back to the turbulence of the 1990s and undo years of economic prosperity and political stability.