Libyan military officials say gunmen have killed five soldiers in overnight attacks on at least six security buildings and outposts throughout the eastern city of Benghazi.

Spokesman for the army's chief of staff Ali el-Sheikhy says no group has claimed responsibility for the attacks. Officials have also not announced any arrests.

Just after midnight on Saturday, gunmen in civilian clothes assaulted military outposts and the National Security Directorate with rocket-propelled grenades and heavy weapons.

The military's chief of staff, in a statement broadcast on Libyan state TV just before dawn, says at least one outpost was burnt.

Tensions are high in Benghazi over militias. The attack comes nearly a week after 31 people, mostly demonstrators, were killed during anti-militia protests. The military has since take over several militia bases there.