Abdelaziz al-Hasadi was gunned down while visiting relatives in his hometown of Derna yesterday, Justice Minister Salah al-Marghani said.
Hasadi, who was widely considered to be an Islamist, was the first prosecutor general appointed after longtime dictator Moamer Kadhafi was toppled and killed in the 2011 uprising. Hasadi resigned from the post in March 2013.
Since the collapse of Kadhafi's autocratic regime, Libya has been plagued by violence, including a string of killings targeting top army and security officials as well as judges.