Afzali was an engineer and a captain in the Imperial Iranian Navy. After the 1979 revolution, he continued to serve in the Navy and took part in the homeland–Iraq War. Then Iranian president Abolhassan Bani Sadr appointed him as the commander of the Navy in June 1980.He was also special adviser of then speaker of the Iranian parliament, Ali Akbar Hashemi Rafsanjani.
At the beginning of 1983, Afzali, along with more than a thousand members of the Tudeh Party was arrested by the IRP. The trial carried out in the form of a military tribunal in December 1983, and 32 of them were sentenced to death. Their judge was Hojjat Al Islam Mohammad Reyshahri, who also interrogated Mahdi Hashemi in 1986. The location of the tribunal has been never revealed.Ten of these Tudeh members were executed.On 25 February 1984, Afzali was executed on charges of espionage for the Soviet Union.
