Turkey and Russia, whose up-and-down relationship has helped shape the Syrian war and the many related crises, shared a new trauma Monday after a Turkish gunman assassinated Russia’s ambassador at an art gallery in the Turkish capital, Ankara.

Andrey G. Karlov, the Russian ambassador to Turkey, was giving a speech when an off-duty police officer fatally shot him at the lectern.

No group has claimed responsibility for the attack. The gunman, who was killed at the scene, shouted “God is great” in Arabic and later said in Turkish: “Don’t forget Aleppo. Don’t forget Syria.” That may hint at his motive: The Russian air force was a key part of the Syrian government’s successful assault on rebel-held parts of Aleppo, which included widespread attacks on civilians.

The killing caused global alarm and questions about where it would lead. On social media, many drew parallels to the political assassination of Archduke Franz Ferdinand of Austria, which helped set off the First World War — a comparison that analysts, thankfully, reject.

Here’s what the killings means for Turkey, Russia, Syria and the West.

Could this lead to war between Turkey and Russia?

That seems very unlikely. So far, both countries are working to manage the situation and are sending signals of cooperation. They appear to be aligning their explanations of what happened, pointing their fingers at mutual enemies but not each other.

The reason is Syria. In the past few months, Turkey and Russia have taken pains to line up their once-conflicting strategies there.

Aaron Stein, a Turkey expert at the Atlantic Council, put it bluntly: “Turkey needs Russia to advance its war interests. Russia needs Turkey to win, as it defines winning, in Syria. Everyone has an incentive to handle this like adults.”

A crisis over a dead ambassador could jeopardize the two countries’ stakes in Syria — or, worse, revive the destabilizing tensions of last year — so they are working to smooth things over.

Why has there been tension between Turkey and Russia?

Also over Syria, which goes to show the volatility of the situation. It also demonstrates that both countries are so focused on protecting their Syria agendas that even their nationalistic, grievance-prone leaders would rather play it cool.

The two countries were, and to some extent still are, on opposite sides of the Syrian war. Turkey opposes President Bashar Assad of Syria and has backed rebel groups. Russia supports Assad and entered the conflict on his behalf in the fall of 2015.

Shortly after Russia intervened, its planes began bombing Turkish-backed rebels and flew along — Turkey says across — the Turkish-Syrian border. In November 2015, Turkey shot down a Russian jet, precipitating a major crisis and fears of war. That also could have pulled in the United States, which is bound by treaty to defend Turkey, a NATO ally, and wanted to avoid escalation in Syria.

Under those circumstances, the assassination of an ambassador could provoke an even larger conflict. But over the past year, the countries’ relationship has changed significantly.

How did they go from enemies to partners?

Loading... Loading... Loading... Loading... Loading... Loading...

After years of pursuing Assad’s downfall, Turkey shifted this summer to a more modest strategy: preventing Syrian Kurdish groups from accumulating too much territory along the border. That change aligned the country with Russia.

Turkey fears that Kurdish control of the border would strengthen Kurdish separatism in Turkey, where the government is fighting Kurdish groups, some of which have carried out terrorist attacks.

Russia’s entry into the war also changed Turkey’s calculus, making the campaign against Assad suddenly costlier and less likely to succeed.

Russia, for its part, initially struggled to gain ground against the Syrian rebels, some of whom received Turkish backing. Moscow appears to have concluded that it is better off with Turkey as a partner than an adversary.

The two countries appeared to settle on an unofficial deal: Turkey would drop its support for certain rebels who threatened Russian interests in Syria, and Russia would drop its support for Syrian Kurdish groups. Russia also allowed Turkish troops and allied militias to occupy Syrian border territory that had previously been controlled by Kurds and Daesh, also known as ISIS and ISIL.

Stein of the Atlantic Council called the arrangement “Aleppo for Al Bab”: Russia and Assad would take Aleppo, while Turkish-allied militias would take the strategically located town of Al Bab.

Because the cities are nearly adjacent, the Turkish and Russian campaigns benefit each other. At the same time, with their forces mere miles apart, a major breakdown over Karlov’s assassination would simply be too dangerous to tolerate.

Will the assassination change anything?

There is no indication so far that Turkey or Russia will alter their Syria policies. If anything, the attack could cement their partnership.

Stein predicted that President Recep Tayyip Erdogan of Turkey would seek to distract attention from his government’s unpopular Syria policy by pinning the attack on the U.S.-based Turkish cleric Fethullah Gulen, whom Erdogan also blamed for a coup attempt in Turkey this summer.

Gulen has denied the charges, and Washington has refused to extradite him, citing a lack of evidence. That has strained ties between the United States and Turkey, though this tension serves Erdogan by helping him to rally support at home, where the United States is unpopular.

“The biggest loser from this will be Washington,” Stein said. “It’s completely counterintuitive, but it’s Washington.”

Read more about: