Andrey Karlov, Russia's ambassador to Turkey was shot in the back and killed as he gave a speech at an Ankara art gallery on Monday by an off-duty police officer who shouted "don't forget Aleppo" and "Allahu Akbar" as he opened fire.

Russia's Foreign Ministry confirmed Karlov's death, calling it a "terrorist act." Relations between Moscow and Ankara have long been strained over the conflict in Syria, with the two support opposing sides in the war.

>> Be the first to get updates on Russia and Turkey: Download our App, sign up to Breaking News Alerts, and Subscribe

Russia is an ally of Syrian President Bashar Assad and its airstrikes helped Syrian forces end rebel resistance last week in the northern city of Aleppo. Turkey, which has long sought Assad's ouster, has been repairing ties with Moscow after shooting down a Russian warplane over Syria last year.

Open gallery view The shooting of Andrey Karlov, the Russian ambassador to Turkey, after being shot at an Ankara art exhibit, December 19, 2016 Credit: Burhan Ozbilici, AP

Open gallery view The gunman who fatally shot Russia's ambassador to Turkey in Ankara. Credit: Burhan Ozbilici, AP

Open gallery view The gunman who fatally shot Russia's ambassador to Turkey in Ankara. Credit: Burhan Ozbilici, AP

Erdogan, who has faced a string of attacks by Islamist and Kurdish militants as well as an attempted coup in July, identified the attacker as 22-year-old Mevlut Mert Altintas, who had worked for Ankara riot police for two and a half years. Two security sources told Reuters he was not on duty at the time. CNN Turk TV said police had detained Aydintas's sister and mother.

The attacker was smartly dressed in black suit and tie and stood, alone, behind the ambassador as he made a speech at the art exhibition, a person at the scene told Reuters.

"He took out his gun and shot the ambassador from behind. We saw him lying on the floor and then we ran out," said the witness, who asked not to be identified. People took refuge in adjoining rooms as the shooting continued.

A video showed the attacker shouting: "Don't forget Aleppo, don't forget Syria!" and "Allahu Akbar" (God is Greatest) as screams rang out. He paced about and shouted as he held the gun in one hand and waved the other in the air.

Open gallery view Turkish police secure the area near an art gallery where Russia's envoy to Turkey was fatally shot, Ankara, Turkey, December 19, 2016. Credit: Umit Bektas, Reuters

Open gallery view Turkish police secure the area near an art gallery where Russia's envoy to Turkey was fatally shot, Ankara, Turkey, December 19, 2016. Credit: Umit Bektas, Reuters

Open gallery view Russia's ambassador to Turkey speaks at an art gallery in Ankara before being fatally shot. Credit: Anadolu Agency

A Reuters cameraman at the scene said gunfire rang out for some time after the attack. Turkey's Anadolu news agency said the gunman had been "neutralized," apparently killed.

Another photograph showed four people the ambassador lying on the floor.

Open gallery view Turkish police secure the area near an art gallery where Russia's envoy to Turkey was fatally shot, Ankara, Turkey, December 19, 2016. Credit: Umit Bektas, Reuters

"We regard this as a terrorist act," said Russian Foreign Ministry spokeswoman Maria Zakharova. "Terrorism will not win and we will fight against it decisively."

It was not clear whether the gunman was a lone operator, driven perhaps by popular discontent over Russian action in Syria or affiliated to a group like Islamic State, which has carried out a string of bomb attacks in Turkey in the last year.

Which ever is the case, the incident raises concerns about a police force currently being purged after a failed July coup.

Turkish President Tayyip Erdogan contacted Russian President Vladimir Putin to brief him on the shooting. Following their talk, Putin said in televized comments that the assassination was a despicable provocation aimed at spoiling Russia-Turkey ties and derailing Moscow's attempts to find, with Iran and Turkey, a solution for the Syria crisis.

Putin, who said he personally knew the slain envoy, said he had agreed in a phone call with his Turkish counterpart Tayyip Erdogan that Russian investigators would soon fly to Ankara to help the Turks with the investigation.

Analysis: Don't Expect a Diplomatic Meltdown Over Russian Envoy's Murder

Turkish Foreign Minister Mevlut Cavusoglu was due to meet with his Russian and Iranian counterparts in Russia on Tuesday to discuss the situation in Syria. Officials said the meeting would still go on, despite the attack.

Turkey's foreign ministry said it would not allow the attack to cast a shadow over Ankara's relations with Moscow.

"The attack comes at a bad time: Moscow and Ankara have only recently restored diplomatic ties after Turkey downed a Russian aircraft in November 2015," the Stratfor think-tank said.

"Though the attack will strain relations between the two countries, it is not likely to rupture them altogether."

The U.S. State Department, involved in diplomatic contacts with Russia in an attempt to resolve a refugee crisis unfolding around the city of Aleppo, condemned the attack. U.S. President-elect Donald Trump also condemned the assassination by what he said was a "radical Islamic terrorist."

Prime Minister Benjamin Netanyahu condemned the "brutal murder" of the envoy, and sent Israel's "deepest consolations" to his family and the Russian people. "The murder of a diplomat emphasizes the need of the civilized world to unite in the joint battle against the forces of terrorism," Netanyahu said.

Tensions have escalated in recent weeks as Russian-backed Syrian forces have fought for control of the eastern part of Aleppo, triggering a stream of refugees.

Turkey has been hit by multiple bomb attacks that have been claimed by Kurdish militants, and beat back an attempted coup in July, where rogue soldiers commandeered tanks, warplanes and helicopters in attempt to overthrow the parliament.

Since then, the government has launched a sweeping crackdown on the judiciary, police and civil service in attempt to root out the coup plotters. The involvement of a police officer in Monday's attack could raise questions for Erdogan about a force denuded now of a number of senior and rank-and-file officers.

Official: 'Gunman had links to Gulen'

A Turkish security official said Ankara saw "very strong signs" the gunman was a follower of a U.S.-based Muslim cleric blamed for orchestrating a failed coup in July.

A representative of cleric Fethullah Gulen, Alp Aslandogan, denied any link and said the exiled cleric condemned the murder as a "heinous act".

The Turkish official, who declined to be identified, said the current investigation was focused on the gunman's links to the network of Gulen's followers, which the government calls the "Gulenist Terrorist Organisation" or "FETO".

Open gallery view Turkish President Erdogan, left, and Turkish Muslim preacher Fethullah Gulen, right. Credit: Zaman Daily and Selahattin Sevi, AFP

The government says Gulen, who has lived in self-imposed exile in the U.S. state of Pennsylvania since 1999, created a "parallel network" in the police, military, judiciary and civil service aimed at overthrowing the state. Gulen denies this.

"The people he lived with before school were detained over FETO. It was determined that the people with whom he graduated from school were from a FETO team," the senior security official said of the attacker.

"Information was obtained to the effect that people who helped him get into school were from FETO. There are very strong signs that the person who carried out this attack was from FETO. The investigation is currently focused totally on this."

The official also cited the fact that the attacker had taken July 15-17 as holiday. The government may argue the timing of his holiday demonstrated foreknowledge of the July 15 coup.

Gulen adviser Aslandogan, who advises Gulen on media issues, said the allegations by the Turkish official were "laughable" and intended to cover up for lax security.

"Mr. Gulen categorically condemns this heinous act," he told Reuters.

Putin promises to step up terrorism fight

In televised comments, Putin, speaking at a special meeting in the Kremlin, ordered security at Russian embassies around the world to be stepped up and said he wanted to know who had "directed" the gunman's hand.

Putin heaped praise on the murdered Russian ambassador and made clear that Moscow's response to his assassination would be robust.

"A crime has been committed and it was without doubt a provocation aimed at spoiling the normalization of Russo-Turkish relations and spoiling the Syrian peace process which is being actively pushed by Russia, Turkey, Iran and others," said a stern-faced Putin.

"There can only be one response - stepping up the fight against terrorism. The bandits will feel this happening."

In an odd coincidence, Putin had been planning to attend a Moscow play on Monday night written by Alexander Griboyedov, Russia's ambassador to Iran, who was murdered in 1829.