By TIM ARANGO and RICK GLADSTONE
ISTANBUL â€” Russiaâ€™s ambassador to Turkey was assassinated at an Ankara art exhibit on Monday evening by a lone Turkish gunman shouting â€œGod is great!â€ and â€œdonâ€™t forget Aleppo, donâ€™t forget Syria!â€ in what the leaders of Turkey and Russia called a provocative terrorist attack.
The gunman, described by Turkish officials as a 22-year-old off-duty police officer, also wounded at least three others in the assault on the envoy, Andrey G. Karlov, which was captured on video. Turkish officials said the assailant was killed by other officers in a shootout.
The assassination, an embarrassing security failure in the Turkish capital, vaulted relations between Turkey and Russia to a new level of crisis over the Syrian conflict on Turkeyâ€™s southern doorstep, now in its sixth year.
The longer-term implications for the Russia-Turkey relationship, which had been warming recently after plunging a year ago, were not immediately clear. But some analysts played down the notion that the assassination would lead to a new rupture, saying it could conversely bring the countries closer together in a shared fight against terrorism.
President Vladimir V. Putin of Russia said on Russian television that Mr. Karlov had been â€œdespicably killedâ€ to sabotage ties with Turkey. Mr. Putin spoke with the Turkish president, Recep Tayyip Erdogan, by phone, and the two leaders agreed to cooperate in investigating the killing, and in combating terrorism broadly.
In an emergency meeting with Foreign Minister Sergey V. Lavrov and other top officials, Mr. Putin said, â€œThere can be only one answer to this â€” stepping up the fight against terrorism, and the bandits will feel this.â€
Mr. Erdogan, in a speech late Monday night, said the assassination was a provocation meant to derail efforts by Turkey and Russia to collaborate more closely on regional issues and economic ties.
â€œWe know that this is a provocation aiming to destroy the normalization process of Turkey-Russia relations,â€ Mr. Erdogan said. â€œBut the Russian government and the Turkish republic have the will to not fall into that provocation.â€
The assassination came after days of protests by Turks angry over Russiaâ€™s support for the Syrian government in the conflict and the Russian role in the killings and destruction in Aleppo, the northern Syrian city.
The Russian envoy was shot from behind and immediately fell to the floor while speaking at an exhibition of photographs, according to multiple accounts from the scene, the Contemporary Arts Center in the Cankaya area of Ankara.
The gunman, wearing a dark suit and tie, was seen in video footage of the assault waving a pistol and shouting in Arabic: â€œGod is great! Those who pledged allegiance to Muhammad for jihad. God is great!â€
Then he switched to Turkish and shouted: â€œDonâ€™t forget Aleppo, donâ€™t forget Syria! Step back! Step back! Only death can take me from here.â€
Turkish officials said the gunman was killed after a shootout with Turkish Special Forces.
He was identified by Turkeyâ€™s interior minister as Mevlut Mert Altintas, from the western province of Aydin and a graduate of a police college in Izmir. Local news reports said that Mr. Altintasâ€™s mother and sister had been arrested and that a computer had been confiscated from their house.
While it was too early to tell if the gunmen acted alone, his use of jihadist slogans and his invocation of Syria raised the possibility that he was a member, or at least a sympathizer, of an Islamist group like Al Qaedaâ€™s Syria affiliate or the Islamic State, two organizations that Turkey has been accused by allies, including the United States, of supporting in the past.
Russiaâ€™s Foreign Ministry spokeswoman, Maria Zakharova, told the Rossiya 24 news channel that Mr. Karlov had died of his wounds in what she described as a terrorist attack. Turkeyâ€™s Interior Ministry said the ambassador had died at Guven Hospital in Ankara.
Russian news agencies said the ambassadorâ€™s wife fainted and was hospitalized after learning of her husbandâ€™s death. They also said that as a precaution, Russian tourists in Turkey had been advised against leaving their hotel rooms or visiting public places.
Russiaâ€™s Tass news agency said that Mr. Karlov had been shot from behind while finishing remarks at the opening of an art exhibition titled â€œRussia Through Turksâ€™ Eyes.â€
Mr. Karlov, who started his career as a diplomat in 1976, worked extensively in North Korea over two decades, before changing regions in 2007, according to a biography on the Russian Embassyâ€™s website. He became ambassador in July 2013.
The attack was a rare instance of an assassination of a Russian envoy. Historians said it might have been the first since Pyotr Voykov, a Soviet ambassador to Poland, was shot to death in Warsaw in 1927.
For many Russians, the assassination is likely to recall the 19th-century killing in Tehran of Aleksandr Griboyedov, a poet and diplomat who died after a mob stormed the Russian Embassy. That episode is remembered as the most severe insult to Russiaâ€™s diplomatic corps in the countryâ€™s history.
More recently, the Lebanese Shiite militia Hezbollah, now allied with Russia in Syria, kidnapped four Soviet diplomats in 1985, killing one and releasing three a month later.
The United States, which has tangled bitterly with Russia over the Syrian conflict, quickly condemned the assassination in Ankara. In a statement, Secretary of State John Kerry called it a â€œdespicable attack, which was also an assault on the right of all diplomats to safely and securely advance and represent their nations around the world.â€
Other prominent officials who often criticize Russiaâ€™s actions in Syria and elsewhere also offered their condolences. â€œNo justification for such a heinous act,â€ said Jens Stoltenberg, the secretary-general of NATO, said on Twitter. Secretary-General Ban Ki-moon of the United Nations said he was â€œappalled by this senseless act of terror.â€
President-elect Donald J. Trump, who has been accused by critics of aligning with Russia, said in a statement that Mr. Karlov had been â€œassassinated by a radical Islamic terrorist.â€
The assassination also illustrated the long reach of the Syrian war. It has destabilized Europe with hundreds of thousands of refugees, spawned terrorist attacks in Paris and Brussels, and led to the rise of the Islamic State, which controls territory across Iraq and Syria.
When the war began, Turkey was rising and confident, and Mr. Erdogan, then its prime minister, began supporting rebels seeking the ouster of the Syrian president, Bashar al-Assad. Preoccupied with bringing Mr. Assad down, Turkey opened its borders to weapons and fighters flowing to the rebels, turning a blind eye, for a time, when the opposition turned increasingly Islamist.
As the war ground on, the consequences for Turkey were profound. It was overwhelmed with refugees â€” more than three million now reside in the country â€” and the rise of the Islamic State led to terrorist attacks within Turkeyâ€™s borders.
In the fall of 2015, Russia entered the conflict in support of the Syrian government, reinforcing Mr. Assad at a weak moment and dealing a blow to Turkeyâ€™s ambitions in Syria. Relations between Turkey and Russia reached a low point in November 2015 after Turkey shot down a Russian jet near the Syrian border.
But this year, in an effort to restore relations, Mr. Erdogan, now Turkeyâ€™s president, met with Mr. Putin in St. Petersburg, and ever since the two countries have largely put aside their differences on Syria and focused on improving economic ties. In August, when Turkeyâ€™s military went into Syria to push the Islamic State out of the border town of Jarabulus, the move was widely seen as having been made with the tacit approval of Russia.
For Turkey, the Ankara attack resonated in the Turkish collective memory: Turkey lost many diplomats in the 20th century to Armenian militants in a campaign to avenge the Armenian genocide during World War I.
â€œTurkey is very aware of the size of this failure, and I think the government will make every effort to investigate this fully,â€ Sinan Ulgen, a Turkish former diplomat who is the chairman of the Center for Economics and Foreign Policy Studies, an Istanbul research organization, said of the Russian diplomatâ€™s assassination. â€œI donâ€™t expect any crisis between Turkey and Russia.â€
Since the Turkish military incursion into Syria in August, Mr. Erdoganâ€™s criticism of Russia over Syria had been muted. But Mr. Erdogan faced a dilemma: Even as he was warming to Russia, he faced a Turkish public, not to mention the Syrian refugees within Turkey, angry over Russiaâ€™s role in the bombing of Aleppo.
On Monday evening in Istanbul, just after the assassination, a group of protesters gathered outside the Russian consulate on Istiklal Avenue, the cityâ€™s largest pedestrian street. The gathering was more street theater than protest, with two men lying on the street, shrouded in bloody sheets and the Syrian flag, and surrounded by candles, to represent the killings in Aleppo.
Mohammed al-Shibli, a Syrian activist who participated, said, â€œI felt extreme happiness when I heard the newsâ€ of the assassination.
He continued: â€œThis is the first step in getting justice for the Syrian people. The ambassador is not innocent. He represents the foreign policy of his murderous state and thus he is a murderer, as well. Now we are waiting for revenge against everyone who shed blood in Syria.â€