A judge was shot dead outside a court in the eastern Libyan city of Derna on Sunday, an official said, just weeks after courts resumed work there following the 2011 war.
Assailants killed Mohammed Houidi on Sunday morning as he came out of a court in the city, which is known as an Islamist stronghold.
Hasadi said courts in the city had only recently properly resumed work following disruption due to the 2011 war that ousted Muammar Gaddafi. As with elsewhere in the North African country, state security forces and courts there remain weak.
A relative of Houidi confirmed what Hasadi said and added: "The courts only started working again and this may have upset people who have openly been calling for Islamic law to be implemented in Derna."
Residents say there have been several demonstrations, led by members of some Islamist militias, calling for sharia law in recent months.
Libya has seen a step up in violence in recent weeks as the government struggles to impose its authority on a country awash with weapons and where militias often do as they please.
Six soldiers were killed and five injured in clashes between Libyan special forces and armed protesters outside a special forces base in the eastern city of Benghazi on Saturday, military officials said.