Turkey is 'playing a dangerous game' - and what comes next could make it worse
And what happens next will determine just how messy Ankara's Syria policy has become.
The dramatic reversal came after an ISIS-affiliated suicide bomber killed 32 activists in the southeastern town of Suruc, just across the border from the embattled city of Kobani, Syria.
The Turkish side of the border had remained relatively peaceful up until then, despite the vast number of foreign fighters coming and going from Turkey and Syria.
That status quo was likely the result of high-level communication between Turkish officials of the ruling AKP party and ranking ISIS members, Jonathan Schanzer, vice president for research at Foundation for Defense of Democracies, told Business Insider.
"The border has been exceptionally quiet, which is a major indicator, for me, that the AKP had intelligence ties to ISIS," Schanzer said, noting how kind Turkey's border policies have been to the jihadis.
Since 2011, Turkey's southern border has served as a transit point for cheap oil, weapons, foreign fighters, and pillaged antiquities. As the conflict progressed, the fighters taking advantage of this loose border enforcement were more and more radical.
Earlier this year, ISIS (aka Islamic State, ISIL, Daesh) controlled about 40% of the 565-mile border with Syria and militants were often seen near the border.
"Given the overall posture of [ISIS], why else would it refrain from attacking a pro-Western NATO member?" Schanzer added.
The evidence of some sort of arrangement is piling up: Martin Chulov of the Guardian recently reported that a US-led raid on the compound housing the Islamic State's "chief financial officer" detailed how Turkish officials directly dealt with ranking ISIS members.
The ties the ruling AKP established with ISIS extremists helped maintain some form of plausible neutrality in the conflict - but any crackdown could lead to severe blowback.
"It's a dangerous game they've always been playing," Schanzer told BI.
And the game just became even more dangerous: Turkey launched airstrikes against ISIS and the Kurdish PKK on the same day, ending a two-year peace treaty with the Kurds that could further complicate Ankara's relationship with both ISIS and Washington.
While the White House has said that Ankara is within its rights to "take action related to terrorist targets," the PKK was working with US-backed Kurdish fighters to repel ISIS from northern Iraq.
Furthermore, the Kurdish YPG militia - the armed wing of the Kurdish PYD, which has direct links with the PKK - has proven to be the most effective force fighting ISIS on the ground in northern Syria while being backed by US airstrikes.
Nevertheless, AKP-led Turkey continues to bomb the PKK.
"The AKP needed the Kurdish angle to sell the war to ultra-nationalists inside Turkey," whose main priority is to curb Kurdish territorial gains along its southern border, Schanzer explained.
The Kurdish groups, for their part, see Turkey's new policy as aimed directly at them and not ISIS.
"The PYD/YPG feels this is a Turkish move to prevent the expansion of their territory in Syria. They think Turkey is not serious aboutfighting the Islamic State," Wladimir van Wilgenburg, a Kurdish analyst at the Jamestown Foundation, told Business Insider in an email.
Following the fall of Syrian border city Tal Abyad to the Kurds in May, Erdogan vowed that Turkey "will never allow the establishment of a new state on our southern frontier in the north of Syria," and a pro-government newspaper declared the Kurdish PYD to be "more dangerous than ISIS."
So as the Kurds make gains in Syria and Iraq, Ankara gets more involved.
"It looks to me like a lot of the progress [Turkey made with the Kurds] is going to be unraveled," Schanzer said.
And then then there's the domestic angle for Erdogan.
Capitalizing on the nationalist sentiment that has been steadily growing inside Turkey - especially since the Suruc bombing and the murder of two Turkish police officers by Kurds in the southeast - could also help Erdogan regain his party's absolute majority if coalition talks fail and new elections are called.
"Turkey's domestic policy and foreign policy have become messily mixed together," Soli Ozel, a Turkish political commentator and professor at Kadir Has University in Istanbul, told The Wall Street Journal.
"It's now very difficult to separate the domestic political considerations from the security and strategic considerations of those who have started the air strikes."
In any case, Ankara's priorities seem clear.
Turkish Prime Minister Ahmet Davutoglu said that Turkish security forces have rounded up 1,050 suspected members of ISIS, Kurdish militants, and ultra-leftists recently.
But local media reported the vast majority of the detainees were Kurdish and leftists - not members of ISIS.
Michael B. Kelley contributed to this report.