The Russian ambassador to Turkey Andrei Karlov 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.

President Tayyip Erdogan, in a video message to the nation, cast the attack as an attempt to undermine NATO-member Turkey's relations with Russia - ties long tested by the war in Syria. He said he had agreed in a telephone call with Russia's Vladimir Putin to step up cooperation in fighting terrorism.

At a special meeting at the Kremlin, President Putin ordered increased security at all Russian missions and said "the bandits" who committed the act would feel retribution.

"We must know who directed the killer's hand."

The assassination of an ambassador, not least of a major power such as Russia, marks a dangerous escalation of tension in the region and beyond. Security sources said he was off duty and some witnesses said there was no security scanning machine at the entrance.

The attacker was smartly dressed in black suit and tie and stood, alone, behind the ambassador as he began his 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.

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

The gunman was killed by special forces. Three other people were injured.

"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."

GULEN

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. CNN Turk TV said police had detained his sister and mother.

A senior security official said there were "very strong signs" the gunman belonged to the network of the U.S.-based cleric Fethullah Gulen, who Ankara says orchestrated the failed coup in July. Erdogan has denounced Gulen as a terrorist, but the cleric, a former ally, denies the accusation.

Gulen described the killing as a "heinous act of terror" that pointed to a deterioration of security in Turkey resulting from Erdogan's wideranging purge of police as well as the army, judiciary and media following the coup bid.

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.

Suspicion could also fall on a group such as Islamic State, which has carried out a string of bomb attacks in Turkey in the last year as Ankara has pressed a military campaign against the militants in Syria. The group has urged "lone" attacks in the West.

U.S. STATE DEPARTMENT

Turkish Foreign Minister Mevlut Cavusoglu was due to meet 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.

"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."

However, both Russia and Turkey indicated that they were looking to work together to find the combat militant attacks.

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, as did the United Nations Security Council.

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.