He said security forces and citizens blocked the city's surrounding roads after the attack, which left six people wounded. He said the attack was likely a reprisal by Islamist militiamen targeted by the forces of renegade Libyan Gen. Khalifa Hifter.
Hifter's forces have been shelling boats smuggling weapons to the militia, said the official, who spoke on condition of anonymity because he was not authorized to brief reporters.
Over the past weeks, forces allied with Hifter have bombed the camps of Islamist militias, which have attacked his troops in return. They also attempted to assassinate Hifter himself, but killed four others instead in the attack.
Libya is scheduled to hold parliamentary elections on June 25, aimed to end a standoff between Islamist and non-Islamist political groups.