ANKARA, Turkey (AP) -- A Turkish policeman fatally shot Russia's ambassador to Turkey on Monday in front of a shocked gathering at a photo exhibit and then, pacing near the body of his victim, appeared to condemn Russia's military role in Syria, shouting: "Don't forget Aleppo! Don't forget Syria!"
The leaders of Turkey and Russia said the attack in Ankara, the Turkish capital, was an attempt to disrupt efforts to repair ties between their countries, which have backed opposing sides in the Syrian civil war.
An Associated Press photographer and others at the art gallery watched in horror as the gunman, who was wearing a dark suit and tie, fired at least eight shots, at one point walking around Ambassador Andrei Karlov as he lay motionless and shooting him again at close range.
The assailant, who was identified as Mevlut Mert Altintas, a 22-year-old member of Ankara's riot police squad, was later killed in a shootout with police. Three other people were wounded in the attack, authorities said.
The assassination came after days of protests by Turks angry over Russia's support for President Bashar Assad in the Syrian conflict and Russia's role in the bombardment and destruction of Aleppo, Syria's largest city.
The gunman shouted about Aleppo in Turkish, and also yelled "Allahu akbar," the Arabic phrase for "God is great," continuing in Arabic: "We are the descendants of those who supported the Prophet Muhammad, for jihad."
The attack, condemned by the White House and the United Nations, was another sign of how Turkey, a NATO member and a partner in the U.S.-led campaign against the Islamic State group, is struggling to contain multiple security threats. The war in Syria has been a major problem for years, sending several million refugees into Turkey and, more recently, drawing in Turkish troops.
Turkey has become accustomed to deadly attacks — Kurdish militants claimed responsibility for Dec. 10 bombings in Istanbul that killed 44 people, many of them police.
The spectacle of 62-year-old Karlov's assassination by a member of the Turkish security forces at a photography exhibit meant to highlight Russian culture reinforced the sense of unease over the region's conflict and complex web of alliances and relationships.
It came a day before a key meeting about Syria to be held in Moscow. Those attending include the foreign and defense ministers from Turkey, an opponent of Assad, and Russia and Iran, backers of the Syrian regime.
Russian President Vladimir Putin described the killing of Karlov as an attempt to damage Russia-Turkey ties "and to thwart a peace process in Syria which Russia, Turkey and Iran have been actively trying to promote."
Putin said he and Turkish President Recep Tayyip Erdogan agreed in a phone call that Russian investigators would fly to Ankara to conduct a joint probe with their Turkish counterparts.
"We must know who was directing the killer," Putin said in televised remarks. He ordered top officials to strengthen protection of the Turkish Embassy in Moscow and asked Turkey to increase security at the Russian mission in Ankara.
In a video message shown on several Turkish TV channels, Erdogan said: "This is a provocation to damage the normalization process of Turkish-Russian relations. But both the Russian and Turkish administrations have the determination not to fall for this provocation."
Karlov was several minutes into a speech at the embassy-sponsored exhibition in Ankara when he was gunned down.
Altintas, the gunman, also fired shots in the air, sending panicked audience members running for cover, and smashed several of the framed photos hung for the exhibition. The floor was splattered with blood, and the ambassador's eye glasses lay a few feet from his body.
After shooting the ambassador, the gunman got into a 15-minute shootout with police before he was killed, Turkey's state-run Anadolu news agency reported.
The shooter's family home in the western province of Aydin was later searched and his mother, father and sister were detained, the news agency said, without citing sources. The man's house in Ankara was raided and his roommate, also a police officer, was also taken into custody, it said.
Interior Minister Suleyman Soylu said Altintas, who was born in 1994, had been an officer with Ankara's riot police squad for more than two years. He did not give a motive for the attack.
"It's a tragic day in the history of our country and Russian diplomacy," Russian Foreign Ministry spokeswoman Maria Zakharova said.
"Ambassador Karlov has made a lot of personal contributions to the development of ties with Turkey. He has done a lot to overcome a crisis in bilateral relations," she said. "He was a man who put his heart and his soul into his job. It's a terrible loss for us and also the world."
Karlov joined the diplomatic service in 1976. He served as Russia's ambassador to Pyongyang from 2001-2006, and later worked as the chief of the Foreign Ministry's consular department. He had served as the ambassador to Turkey since 2013.
The White House condemned the assassination, saying "this heinous attack on a member of the diplomatic corps is unacceptable," President Barack Obama was briefed by his national security team while on vacation in Hawaii
U.N. Secretary-General Ban Ki-moon also condemned what he called a "senseless act of terror," for which "there can be no justification."
Relations between Russia and Turkey were badly strained by the downing of a Russian warplane at the Syrian border in November 2015, but Turkey's apology earlier this year helped overcome the rift. Putin and Erdogan have held several meetings in recent months and spoken frequently over the phone.
Russia and Turkey have co-sponsored the evacuation of civilians and rebels from Aleppo and also discussed the prospect of organizing a new round of peace talks in Kazakhstan's capital, Astana.
Security threats to Turkey include the Islamic State group, and which has been blamed for attacks in Turkey. Additionally, Turkish security forces and courts remain preoccupied with purging state institutions of the supporters of an exiled Islamist cleric whom the government accuses of staging a failed coup attempt in July.
Associated Press writers Vladimir Isachenkov in Moscow and Zeynep Bilginsoy in Istanbul contributed to this report.