"Unknown assailants opened fire at Colonel Fethallah al-Gaziri, head of Benghazi military intelligence, and killed him," the official told AFP on condition of anonymity.
He said the colonel, recently named to the post, was in Derna for the marriage of a niece. The victim's bullet-riddled body was taken to Derna hospital.
In the wake of the 2011 revolt which toppled dictator Moamer Kadhafi, militants in lawless eastern Libya have targeted security forces and foreigners, as well as judges, political activists and the media, killing more than 300 people.