Fighters from Misrata move towards positions of Islamic State militants, near Sirte March 15, 2015.

Credit: Reuters/Goran Tomasevic

TRIPOLI (Reuters) - Militants loyal to Islamic State claimed an attack on a security headquarters in a suburb of the Libyan capital on Sunday, according to a statement on social media, days after a similar attack on a police station.

A bag of explosives went off in front of the Janzour security directorate, west of Tripoli, wounding five policemen, said Essam Nas, a local security spokesman.

One of the wounded policemen is in a serious condition, he said.

Islamic State militants published on social media a picture of what they said was the explosion.

Militants loyal to Islamic State, the group that controls much of Syria and Iraq, have been exploiting the chaos in Libya where two governments allied to armed factions are vying for power four years after the overthrow of Muammar Gaddafi.

Groups of Islamist militants, who have declared loyalty to Islamic State over the past six months, have claimed responsibility for several high-profile attacks in what appears to be an intensifying campaign.

They claimed responsibility for an attack on the Corinthia luxury hotel in Tripoli in January, which killed five foreigners and at least four Libyans, and killed a group in Egyptian Copts in the central city of Sirte, triggering air strikes by Egypt.

The site of Sunday's explosion is close to the Palm City compound, which used to be a favorite place of accommodation for diplomats and expatriates until last summer when most left due to the deteriorating security situation.