Gunmen killed at least four people and wounded nearly 40 on Wednesday in a suicide attack on a court complex in the Libyan city of Misrata, officials and a witness said.

Islamic State claimed responsibility for the attack, saying in a statement run by the group's Amaq news agency it had targeted "one of the most prominent strongholds" of Libya's U.N.-backed Government of National Accord (GNA).

The attack shows the enduring militant threat in Libya after a Misrata-led coalition under nominal GNA command battled for more than six months last year to oust Islamic State from its former stronghold in Sirte, about 230 km (140 miles) southeast of Misrata.