Here's what we know about a gun attack in Turkey that killed Russian Ambassador Andrei Karlov. (Nicki DeMarco,Adriana Usero/The Washington Post)

Turkish and Russian officials labeled the assassination of Andrey Karlov, Moscow's envoy to Turkey, at an art exhibition in Ankara a “terrorist” attack. Karlov was shot in the back by a gunman who, according to reports, proceeded to shout jihadist slogans.

Russian President Vladimir Putin said the attack was “a provocation” that wouldn't affect the thaw in relations between Moscow and Ankara, which were plunged into crisis last year as the countries took different sides in Syria's civil war. Russia's intervention in the war on behalf of the regime of Syrian President Bashar al-Assad infuriated Turkey and its president, Recep Tayyip Erdogan, who was one of the first world leaders to call for Assad's departure.

In the months since, Turkey had to calibrate its position as the Assad regime dug in and Syrian Kurdish factions galvanized support among Turkey's restless Kurdish minority. Recently, Turkey has worked closely with Russia to find a solution for civilians trapped in the war-ravaged Syrian city of Aleppo.

That doesn't mean all Turks accept Russia's role in a conflict that rages on their doorstep. Protests were held outside Russian diplomatic buildings in Istanbul and Ankara. At the scene of Karlov's killing, the shooter reportedly declared that his actions were retribution for Russia's bombardment of rebel-held areas of Aleppo. He was later killed by Turkish security personnel.

Analysts cautioned against alarmist fears of a collapse in diplomatic ties between the two countries.

“No, this is not Sarajevo 1914,” tweeted Turkish columnist Mustafa Akyol, referring to the assassination of a Habsburg royal by a Serbian nationalist that preceded World War I. “For Ankara and Moscow will not wage war. Quite the contrary, they may even get closer.”

Still, Erdogan faces an awkward geopolitical predicament. Turkey's relations with the West are at a low ebb, with many governments condemning Erdogan's purge of opponents in the wake of a failed coup attempt this past summer. He will be compelled to make concessions to Russia after the slaying of its ambassador.

“This could not have come at a worse time for Erdogan, who had been carefully negotiating with Putin over Syria. At a time when his relationship with the U.S. and Europe has soured, the appearance of a rapprochement with Russia was something he needed,” said Henri Barkey, director of the Middle East program at the Woodrow Wilson Institute in Washington. “Now, he will find that his hand with the Russians is even weaker than ever and one can be sure that Putin will milk this as much as he can behind closed doors while offering platitudes in public about unchanging relations. The only thing to be decided is the price Erdogan will have to pay.”

In a statement emailed to the media by the Turkish president's office, Erdogan said that, in a phone conversation with Putin on Monday, the duo “agreed to further strengthen our collaboration particularly in the international fight against terror in the forthcoming days.”

What that means is unclear. Senior Turkish officials, including the country's foreign minister, were scheduled to be in Moscow on Tuesday for talks with Russian and Iranian counterparts about the way forward in Syria. It's the latest indication that Turkey may be resigned to allow Assad's allies in Moscow and Tehran to shape Syria's future.

“Turkey's Syria game is over,” said Selim Sazak, a researcher at the Century Foundation, a New York-based think tank.

At home, Erdogan's allies are pinning the blame on the national bête noire, Fethullah Gulen, an aging Turkish cleric living in exile in the United States who is accused by Ankara of being the mastermind behind July's failed coup attempt. A statement by the country's prime minister connected the assault to “dark forces,” a conspiratorial gesture long deployed by government officials.

“Ankara's best exit here is to pin this on Gulenists, as they did with the Russian jet downing,” Sazak said, referring to an episode last year when Turkish forces shot down a Russian fighter jet conducting sorties over Syria.

Putin said he also wanted to know who “directed” the killer. Turkey may ratchet up the pressure on Washington to extradite Gulen, an impasse that is playing into Moscow's hands. The perceived Western animosity to Erdogan and Turkey's ruling government has given voice to an ultranationalist, “Eurasianist” camp in Turkish politics that wants Ankara to turn its back on Europe and NATO and embrace nations such as Russia and China instead.

“Through conspiracy theories, through pointing the finger at the West, we might see a further pivoting of Turkey toward Russia,” said Aykan Erdemir, a senior fellow at the Foundation for Defense of Democracies, a neoconservative think tank in Washington.

Erdogan and his ruling Justice and Development Party, known by the Turkish abbreviation AKP, draw strength from a conservative Sunni Muslim base, many of whom are irked by the Russian-backed attacks on rebels in Syria. The Turkish president has a “difficult tightrope to walk,” Erdemir said, in balancing the anger of core supporters with the need to mend fences with Russia and Iran.

Meanwhile, the slaying of the Russian ambassador was the latest sign of a security crisis gripping Turkey. The country has seen a worrying spike in terror assaults linked to separate factions of Islamist extremists and Kurdish separatists, all fueled into action by the spiraling chaos in Syria.

“Overall, the strategy is to deflect the domestic security issues as much as possible toward global conspiracies,” Erdemir said. “Admitting domestic security failure is an admission of bad governance.”

More on WorldViews

What the West doesn't understand about Turkey and Erdogan

How the rivalry between Russians and Turks shaped the world