A huge crowd has welcomed home a convicted axe murderer to the Azeri capital of Baku.
Lieutenant Ramil Safarov, who returned to Baku on Friday, was jailed for life after hacking Armenian officer Gurgen Margarian to death in 2004 at a military academy in Budapest, where the servicemen were attending English-language courses organised by NATO.
Safarov claimed that Margarian had insulted Azerbaijan, which fought Armenia over the disputed region of Nagorny Karabakh in the 1990s.
Budapest agreed to extradite Safarov to Azerbaijan, but he was pardoned shortly after returning to his homeland.
Hungary, however, said that Azerbaijan had promised the soldier would serve out the remainder of his sentence after his return home and would not be freed.
Azerbaijan's President Ilham Aliyev issued an order that killer Safarov "should be freed from the term of his punishment" just after he arrived on a plane from Budapest.
The decision prompted harsh criticism and diplomatic action from Armenia, a longtime enemy of its neighbour Azerbaijan.
President Serzh Sarkisian of Armenia said on Friday, "I cannot put up with this. The Republic of Armenia cannot put up with this."
The country also severed its diplomatic ties with Hungary on Friday but Azerbaijan defended its decision.
"Ramil Safarov was pardoned in accordance with the constitution and laws of Azerbaijan and the Convention on the Transfer of Sentenced Persons," presidential administration official Fuad Alekserov said in a statement.
In another move that will infuriate Armenia, Azerbaijan also reinstated Safarov to the army and promoted him to the rank of major.
"Defence Minister Safar Abiyev received him, handed him his new rank and wished him success in his future military service," a defence ministry statement said.
Azerbaijan also hit back at US criticism, insisting that the pardon awarded to Safarov after he had served eight years of his sentence conformed with a European legal convention on extradition.
Tensions are strong between Armenia and Azerbaijan over Nagorno-Karabakh, a region of Azerbaijan that has been under the control of Armenian troops and ethnic Armenian forces since 1994.
A 1994 cease-fire ended the six-year war that killed 30,000 people and left about 1 million homeless.
About 150 demonstrators gathered in Yerevan on Saturday to set the Hungarian flag ablaze and demand an end to talks on resolving the Nagorno-Karabakh issue.