The move to return the Armenian servicemen was on humanitarian grounds, Azerbajjan’s State Commission on Prisoners of War, Missing Persons and Hostages said.
Azerbaijan has released eight Armenian prisoners in an effort to facilitate new talks with France and the European Union on the border conflict between the two countries.
The soldiers were released on Monday after being detained on November 16 last year, according to Azerbaijan's State Commission for Prisoners of War, Hostages and Missing Persons.
The French presidential office said the return came after mediation by France and the European Union and that the return was done by a French plane.
European Council President Michel showed his support of the "positive developments" on Twitter.
The release by Azerbaijan and reparation to Armenia of 8 Armenian detainees is another sign of positive developments following the meeting with @EmmanuelMacron @azpresident @NikolPashinyan— Charles Michel (@eucopresident) February 7, 2022
The EU supports stability and prosperity in the region. pic.twitter.com/PprzrxxRt6
In return, it is expected that Armenia provide information about the Azerbaijani civilians and soldiers killed in the First Karabakh War and presumably buried in mass graves.
"Thanks to our diplomats as well as our soldiers who were mobilised for this operation," wrote French President Emmanuel Macron on Twitter.
Azerbaijan and Armenia fought a six-week war in 2020 that ended with Azerbaijan regaining control of territory that had been occupied by Armenian forces for more than 25 years.
Sporadic clashes have broken out in the area since then; Azerbaijan said some of the returned servicemen took part in November clashes that killed seven Azerbaijani and six Armenian soldiers.