Safarov Armenia
A man protests outside Hungary's Parliament in Budapest after the Azeri axe killer of an Armenian army officer was freed early from his jail sentence (Reuters) Reuters

An Azeri axe murderer has received a hero's welcome on his release from prison where he served eight years for killing an Armenian army officer.

Lt Ramil Safarov of the Azeri army was sentenced in 2004 to 30 years in jail for attacking Armenian army Lt Gurgen Margaryan, 26, who was asleep at the Budapest military academy in Hungary. The two had been attending a Nato "Partnership for peace" training programme.

Margaryan was almost beheaded by 16 axe blows from Safarov, the court heard. The defendant then repeatedly stabbed the corpse in the chest.

Safarov's murderous attack was in response to Margaryan jeering about Nagorno-Karabakh, a predominantly Armenian enclave inside Azeri territory which claimed independence in 1991 during the war between the two countries.

Safarov was a refugee from the region.

He was sentenced to life without possibility of pardon before 30 years but after a deal between the Hungarian and Azerbaijan governments, he was allowed to return to his home country in August to serve the rest of his term.

As he stepped off the plane at Baku airport, however, he was handed a pardon by President Ilham Aliyev, promoted to the rank of major and given a new apartment fully paid for by the government.

He was given a rousing reception in Azerbaijan but his release and the subterfuge around it sparked fury in Armenia.

Some critics speculated that the deal with Budapest had been in exchange for Baku buying large amounts of Hungarian sovereign bonds, which have been downgraded to junk status.The Hungarian government denied the allegations.

The Armenian government in Yerevan cut diplomatic relations with Hungary. Protesters burnt Hungarian flags and threw tomatoes and eggs at the consulate. There were also demonstrations in front of the Hungarian parliament in Budapest.

Safarov Armenia
Protesters burn Hungarian national flag during rally outside Hungarian consulate in Yerevan (Reuters) Reuters

"[They made] a grave mistake," said Armenian president Serzh Sargsyan. "We don't want a war but if we have to we will fight and prevail. We are not afraid of murderers - even those who enjoy the highest patronage."

The escalating situation was worrying foreign officials and international authorities.

"In the interest of regional stability and efforts towards reconciliation [we] reiterate the call on Azerbaijan and Armenia to exercise restraint on the ground as well as in public statements, in order to prevent an escalation of the situation," Catherine Ashton, EU representative for foreign affairs, said.

Nato secretary-general Anders Fogh Rasmussen was flying to Yerevan to meet Armenian. It was not known if he would also visit Azerbaijan.