TRIPOLI - At least four people were killed on Wednesday in an Islamic State group suicide bombing at the main court building in Libya's third-largest city Misrata, security officials and medics said.
Officials said a suicide bomber was able to detonate an explosive vest inside the building in the centre of Misrata, a coastal city about 200 kilometres (125 miles) east of Tripoli.
Thirty-nine wounded were admitted to Misrata's main hospital, medics said.
"Three men belonging to the Islamic State jihadist organisation carried out a suicide attack against the court complex in Misrata... killing four people," General Mohammed Ghassri, a spokesman for armed forces in Misrata that are loyal to the country's internationally-backed Government of National Accord (GNA), said earlier.
He said the three got out of a vehicle and one was able to push his way into the building and detonate explosives. Of the other two, one was shot dead and the other arrested, Ghassri said.
The Facebook page of the pro-GNA forces said a 20-minute exchange of fire followed the explosion.
The attack coincided with the arrival of IS detainees for a court hearing, Libyan news agency LANA reported.
IS claimed responsibility for the attack in a message issued by its propaganda unit Amaq.
On Twitter, the United Nations Support Mission in Libya (UNSMIL) condemned the attack.
UN special envoy Ghassan Salame tweeted: "Indiscriminate attacks on civilians incl. employees of judicial institutions violate human rights law."
Misrata is home to powerful well-armed forces who were the backbone of an offensive that routed IS from the coastal city of Sirte in December 2016.
That offensive was backed by the GNA, one of two main rival governments that emerged from the chaos following the 2011 ouster of long-time strongman Moamer Kadhafi.
The jihadist IS remains a force in Libya despite losing Sirte, after which many of its fighters redeployed to the vast and lawless desert south.
The US military last month carried out a wave of air strikes on IS in Libya, reporting 17 people killed on September 22 at a desert camp 240 kilometres (150 miles) southeast of Sirte.
The US Africa command said the camp was used to move jihadists in and out of the country, store weapons and plot attacks.
In August, IS claimed responsibility for an attack in which 11 people were beheaded at a checkpoint manned by forces loyal to military strongman Khalifa Haftar.
Nine soldiers and two civilians were killed in that attack in the Al-Jufra region about 500 kilometres (300 miles) south of Tripoli.
Haftar supports an eastern-based administration that is the rival to the GNA.