Lt. Ramil Safarov was given a life sentence in 2006 by the Budapest City Court after he confessed to killing Lt. Gurgen Markarian of Armenia while both were in Hungary for a 2004 NATO language course. Azerbaijan and Armenia are ex-Soviet neighbors who have been locked in a long-standing conflict over the mountainous territory of Nagorno-Karabakh.
In response to Safarov's release, Armenian President Serge Sarkisian said his country was cutting diplomatic ties with Hungary, while Hungarian state news agency MTI reported that protesters in the Armenian capital of Yerevan threw tomatoes at the building housing Hungary's honorary consulate and the tore down the Hungarian flag.
Sarkisian said Armenia was "halting diplomatic relations and all official ties with Hungary."
The White House also criticized the decision to free Safarov.
"President Obama is deeply concerned by today's announcement that the President of Azerbaijan has pardoned Ramil Safarov following his return from Hungary," said a statement from National Security Council Spokesman Tommy Vietor.
Vietor added that Hungary was also being asked to explain its decision to send Safarov home.
While Armenians were livid over Safarov's release, he is considered a hero by many in Azerbaijan for having killed an Armenian.
Hungary returned the 35-year-old Safarov to Azerbaijan only after receiving assurances from the Azerbaijani Justice Ministry that Safarov's sentence, which included the possibility of parole after 25 years, would be enforced.
"The Ministry of Justice of Azerbaijan has further informed the Ministry of Public Administration and Justice of Hungary that Ramil Sahib Safarov's sentence will not be modified but will immediately continue to be enforced, based on the Hungarian judgment," the Hungarian ministry said in a statement issued before the news of Safarov's release was known.
The ministry said it based its decision on the 1983 Strasbourg Convention on the Transfer of Sentenced Persons.
In a brief statement posted in English on his website, Azerbaijani President Ilham Aliyev decreed Friday that Safarov "should be freed from the term of his punishment."
Hungary's Justice Ministry did not immediately respond to a request for comment on Safarov's release.
Hungary, which depends on Russia for most of its energy imports, has been seeking to expand its economic relations with oil-rich Azerbaijan.
Laszlo Borbely, the deputy director of Hungary's Government Debt Management Agency last week told daily newspaper Magyar Nemzet that talks between the two countries about a possible purchase by Azerbaijan of up to 3 billion euros ($3.77 billion) in Hungarian bonds were only at an "exploratory phase" for now.
Nagorno-Karabakh lies within Azerbaijan, but has remained under the control of Armenian troops and ethnic Armenian forces since the end of a six-year separatist war in 1994. Diplomatic efforts to settle the conflict have brought no result, and shootings on the Armenian-Azerbaijani border have been common.
During his trial in Budapest, Safarov claimed that the conflict was at the root of his actions and that he used an ax to kill Markarian while the victim was sleeping in a dormitory room after the Armenian repeatedly provoked and ridiculed him.
"My conscience was clouded as a result of the insults and humiliating and provoking behavior, and I lost all control," Safarov told the court in April 2006.
Armenian-backed forces drove Azerbaijan's army out of the ethnic Armenian enclave of Nagorno-Karabakh in the early 1990s. A 1994 cease-fire ended the six-year war that killed 30,000 people and left about 1 million homeless and the enclave is now under the control of ethnic Armenians.
Safarov's lawyers said that his parents and relatives were exiled from Nagorno-Karabakh during the war and that two of his relatives were killed by ethnic Armenian separatists.
Aida Sultanova in Baku, Azerbaijan, contributed to this report.