Just after midnight on January 1st, a lone attacker, Abdulgadir Masharipov, drove up in a taxi to Reina, a famous Istanbul nightclub on the Bosphorus. After exiting the vehicle, the gunman retrieved a Kalashnikov from a bag inside the trunk and began to fire his weapon as he walked towards the club entrance. Less than 10 minutes later, the attacker had expended six magazines of ammunition, killing 39 people and injuring 69.

The Islamic State has been carrying out attacks in Turkey since May 2015. The main group responsible for these — a Gaziantep-based cell headed by Turkish nationals who had spent considerable time in Syria in 2013 and 2014 — was in charge of getting supplies across the Syrian border to the Islamic State. A series of police raids have severely disrupted the cell. More recent Islamic State attacks point to a different Turkey-based network. The Islamic State’s leader, Abu Bakr Al Baghdadi, has specifically called for attacks in Turkey in response to the Turkish military intervention into Syria — Operation Euphrates Shield.

The Reina attack is the latest reminder that the Turkish government has not articulated or executed a coherent strategy to counter the multi-pronged terrorism threat it now faces. This, of course, includes the Kurdistan Workers Party (PKK) in addition to the Islamic State. Instead, the government relies only on military action — divorced from any achievable political goals to address some of the drivers of terrorism. This military-only strategy has created incentives for a surge of populist and anti-Western rhetoric, which is now contributing to the erosion of its relationships with its most important allies, including and especially the United States.

The Reina Attack

Before executing the attack, Masharipov took a series of steps to avoid detection. He first travelled to Konya with his wife and child, before flying to Istanbul. It is unclear where he was living in Istanbul, but closed circuit video footage shows him changing money in Laleli — a neighborhood in Fatih and very close to the apartment where the three Ataturk Airport attackers lived — before storming the airport with AKM assault rifles and suicide vests. The Ataturk attack killed 48 people, including the three bombers. Fragmentary evidence suggests that the Reina shooter had logistical help. At least one other other individual seems to have given him money for an apartment in Konya, a religiously conservative city in the Central Anatolian region of Turkey, and for the attack itself in Istanbul. There are likely more accomplices , as well.

The analysis in Turkey focused mainly on whether the gunman had military training. The few open source videos suggest that the shooter was familiar with his assault rifle, that he taped two magazines together and that he used flash bang grenades. The reality is that regardless of the shooter’s training, grisly success is all but guaranteed for a shooter with a high-capacity firearm who gets into a crowded area, especially at night in a social setting.

The shooter appears to have taken considerable steps to evade police forces. For example, he reportedly took eight taxis — six before the attack and two after as he slipped away. He also made mistakes. During the escape, the shooter left his coat and cash inside the club, and therefore, he had no money to pay for his getaway taxi. He also made a series of phone calls from the driver’s cell phone, a mistake that may have helped Turkish police to narrow the search for the gunman to Istanbul’s Zeytinburnu neighborhood. At the time of writing, it is unclear if the police have recovered the shooter’s cell phone — a key piece of evidence that could help to shed light on his support network.

This episode also illustrates the difficulties in tracking people in Istanbul. Zeytinburnu is home to numerous central Asian migrants and, like in other cases of radicalization of Islamic State members, filled with unofficial mosques and prayer houses, operating outside of the Turkish government’s official religion ministry, Diyanet.

The Terrorism Threat: Turkey’s Multi-Pronged Conflict

The Reina attack comes amid a wave of violence in Turkey and therefore must be seen in context. In the month before the bombing, the Kurdistan Freedom Falcons (TAK), a sub-unit of the PKK, claimed responsibility for suicide attacks in Istanbul’s Besiktas neighborhood and in Kayseri, a city in central Anatolia. The two attacks killed 58. Shortly thereafter, in Ankara, a rogue police officer, Mevlut Mert Altintas, bypassed light security and used his service weapon to assassinate Andrey Karlov, the Russian ambassador to Turkey. The government-allied media allege that Altintas is connected to Fetullah Gulen, a self-exiled cleric now residing in Pennsylvania, who also stands accused of orchestrating the failed July 15, 2016 coup attempt. Others have speculated that Altintas was motivated by Jabhat Fateh al Sham, the Syrian rebel group once affiliated with al-Qaeda, or the Islamic State, andthat he was acting to retaliate against Russia for its military action in support of Bashar al Assad. Altintas’ true motivations are unknown, but there is no denying that before the assassination, many Turkish citizens were outraged with Russia’s campaign in and around Aleppo. There were protests in front of the Russian embassy in Ankara and the consulate in Istanbul. More recently, a police officer in Siirt has been detained for tweeting sympathetic messages about the Islamic State.

In Turkey’s southeast, the PKK continues to fight a rural insurgency as its urban affiliates strike around the country. The Turkish military now finds itself fighting a two front conflict against Kurdish insurgents in Turkey and Syria while also fighting the Islamic State in Syria. The Turkish military has struggled to take the Islamic State held city of Al Bab, losing 16 soldiers recently in a failed assault on the western edge of the city on December 22. The following day, the Islamic State released a video of two Turkish soldiers, both of whom were taken hostage well before the start of Turkey’s current military operation in Syria, being burned alive. The Turkish government has indicated that the Turkish military has not been able to confirm the video’s authenticity, while television pundits routinely suggest that video is a fake or an American plot to unseat the ruling party.

Conspiracy theories aside, the conflagration of these terrorist threats come amid extreme upheaval in the Turkish state following the failed coup attempt. The Turkish government blamed the coup on Fetullah Gulen and, by extension, holds the United States accountable because Gulen is a U.S. green card holder living in Pennsylvania. The onus to provide evidence for his extradition is on the Turkish government.

The failed coup attempt and the wave of terror has, very understandably, increased nationalist sentiment. The government has stoked this increased nationalism and anti-Westernism to blunt criticism of its self-declared “war on terror.” This has resulted in increased anger with the United States, which supports Syria’s PKK affiliate in its battles against the Islamic State. In response, Turkey has curtailed its cooperation with the United States in Syria, according to multiple officials I interviewed. Nevertheless, the Turkish government still finds it politically expedient to blame Washington when it faces heavy losses.

Euphrates Shield and Conspiracy Theories

The Turkish military has curtailed its cooperation with the U.S. led anti-ISIL coalition. Ankara gave Washington little notice that it was about to launch Operation Euphrates Shield. It was timed to coincide with the arrival of Vice President Joe Biden, the second high-level U.S. visit following the failed coup, which could be read as an attempt to embarrass him or present Washington with a fait accompli. The U.S. military quickly came up with a plan to support the operation, including the deployment of American special operations forces with Turkish forces. However, as the operation progressed, Ankara continued to withhold information about the scope and aim of Euphrates Shield. The United States, subsequently, learned about unfolding events in near real time or from insurgent groups fighting alongside Turkish military forces in Syria, according to multiple interviews I’ve conducted. Ankara subsequently expanded the scope of its operation to include Al Bab, but poor planning slowed progress. Ankara has since blamed Washington for the setbacks in Al Bab, without acknowledging that the decisions to march on the city and launch Euphrates Shield were made unilaterally. The dangers of urban combat were easy to foresee.

The Turkish media has explained the hesitance to extend U.S. air support to Euphrates Shield as an example of American support for PKK’s affiliate in Syria, the PYD, and the Islamic State. Turkish President Recep Tayyip Erdogan articulated this in a recent statement, telling reporters that the government has “photos, pictures, and video” of U.S. support for both ISIL and the PYD in Syria. The statement prompted a rebuttal from the U.S. Embassy in Ankara, but the Turkish president has made similar remarks in the past. The pro-government media, in turn, writes frequently about American support for ISIL. In the wake of the Reina attack, the notion that the CIA was somehow involved has gained traction, with Turkish “experts” on television pointing to the use of flash bang grenades as proof of American complicity.

Washington’s reasoning is simple: The extension of air support to Euphrates Shield risks opening a new sub-conflict in Syria between the Turkish military and the PYD. This would detract from efforts to put pressure on Islamic State in Raqqa, its main base of operations in Syria. Thus, to pressure both the PYD and the Turkish military to focus on ISIL, the United States has decided, recently, to only give intelligence and surveillance support for Turkish forces in al Bab. This decision, according to The New York Times and the The Washington Post, comes after Ankara loosened the rules of engagement for coalition drones and manned surveillance planes in the area. The coalition, in turn, appears now to be giving targeting assistance to the Turkish military, a capability that should enhance the effectiveness of Turkish air power, albeit with some increased risk to manned U.S. aircraft operating in the area.

Turkish Populism

This instrumentalization of anti-Westernism combined with an uptick in nationalism helps to advance the AKP’s top legislative priority: the passage of a new constitution that would include a transition from a parliamentary to a presidential system of government. This transition, which has won support from the leadership of the far night nationalist party, the MHP, would consolidate power in the hands of the executive, permanently undermining whatever remains of Turkey’s democratic institutions.

The Turkish government often speaks of the need to unite against terrorism in “all its forms,” an implicit criticism of the United States for its Syria policy. The catch-all phrase, however, is not equal to sound policy. The wave of terrorism in Turkey is largely a byproduct of numerous decisions made in Ankara, many of which stem from the remilitarization of the “Kurdish issue” in 2015 and a consistent to failure to link Turkish ways and means with an achievable end-state in Syria. The Islamic State, by contrast, needs only to survive, before taking advantage of ethnic and religious cleavages to return to areas it has historically retained a footprint.

Absent a broader, political strategy that includes efforts to address the root causes of the PKK-led insurgency in Turkey, the Turkish state’s hard fought gains could unravel in the near-term, both in Syria and in Turkey’s southeast. Turkey’s terrorism problems are interlinked, with actions taken against the PKK reverberating in PYD held Syria, which is now directly adjacent to Turkey’s military zone of influence north of Al Bab. The end result is that the political problems contributing to this wave of terrorism remain unaddressed. The violence is likely to continue. This, in turn, will continue to fuel anti-Western and brash populist rhetoric from Turkey’s ruling party that may be politically beneficial in the short term but disastrous for the long term. It detracts from sound decision-making to address the very real terrorist threat and preserve Turkey’s largely favorable geopolitical position. The Islamic State, meanwhile, has survived despite taking a very heavy beating, and its terrorist tactics are helping to put in place the conditions to allow for it to gain strength in the longer term, underscoring its continued potency as a terrorist group.

Aaron Stein is a Resident Senior Fellow at the Atlantic Council’s Rafik Hariri Center for the Middle East.