Two masked gunmen opened fire on Colonel Ibrahim al-Senussi's car as it travelled through the port city, said Ibrahim al-Sharaa, spokesman for Benghazi's Joint Security Room. He was taken to hospital but died of his wounds.

Car bombings and assassinations of soldiers and police officers have become common in Benghazi, where a suicide bomber detonated an explosives-packed minibus outside a special forces camp last week, killing two people.

Libya's weak central government is struggling to control armed groups, militias and brigades of former rebels who helped oust long-time leader Muammar Gaddafi in the 2011 civil war and who now refuse to disarm.

Most countries have closed their consulates in Benghazi and some foreign airlines have stopped flying to the city since the U.S. ambassador and three other Americans were killed in an Islamist militant attack in September 2012.