Vladimir Putin was among the mourners at a somber funeral ceremony Thursday for the Russian ambassador assassinated by a Turkish gunman who shouted "Allahu Akbar" and "Don't forget Aleppo".

Russia’s president has promised retribution over Andrei Karlov’s killing, which Moscow and Ankara say was a failed attempt to derail a diplomatic rapprochement over Syria.

Leaders, relatives and other diplomats gathered at the Foreign Ministry building where the slain envoy's body lay in an open casket in Russian Orthodox tradition.

Prime Minister Dmitry Medvedev and Foreign Minister Sergei Lavrov laid flowers near Karlov's body in a ceremony in the marbled lobby of the looming Stalin-era skyscraper in central Moscow. Lavrov said Karlov had been the victim of "a despicable terrorist act".

Putin attends the funeral ceremony for Andrei Karlov. Alexei Nikolsky / AP

Putin, who has said he knew Karlov personally and posthumously awarded him the highest military medal of Hero of Russia, paid his respects, briefly sitting beside the coffin and speaking to Karlov's widow.

Karlov was a Soviet-trained diplomat who worked in North and South Korea during the 1990s and 2000s and was sent to Turkey in 2013.

His name was etched into a slab of pink marble on the wall of the foreign ministry building commemorating Russian diplomats killed in the line of duty.

Proceedings moved to Moscow's gold-domed Christ the Saviour Cathedral later on Thursday where the head of the Russian Orthodox Church, Patriarch Kirill, led a ceremony.

"He will go down in the history of the Fatherland," said Kirill.

The envoy was buried later on Thursday in a cemetery in a northern Moscow suburb with military honors, his coffin draped in the Russian flag.

"We must know who directed the killer's hand," Putin said after Karlov was assassinated.

Turkish authorities have identified the assassin as Mevlut Mert Altintas, 22, who had worked for Ankara's riot police. He was later killed by security forces.

President Tayyip Erdogan has blamed the killing on the network of Muslim cleric Fethullah Gulen, something Gulen denies. The Kremlin however has said it is too early to say who stood behind the murder.

Russia has flown a team of investigators to Turkey to help with the investigation.