ISIS on Wednesday claimed responsibility for a deadly gun and bomb attack on Libya’s Foreign Ministry in Tripoli.
The extremist group used its Amaq media outlet to claim that three of its members carried out the attack on Tuesday.
They stormed the foreign ministry headquarters after a car bomb exploded in front of the building.
Two assailants detonated their suicide vests inside the ministry and the third was killed by ministry guards, Reuters reported.
At least three members of staff were killed and 21 others were wounded, health ministry spokesman Wedad Abo Al Niran said.
The Director of the ministry's Islamic Affairs Department Ibrahim Al Shaieb was among the dead, Foreign Minister Mohamed Siala said.
Mr Siala was not injured in the attack.
The foreign ministry denounced the attack, saying "the Libyan people are waging a war on terrorism on behalf of the world".
Mr Siala used the opportunity to denounce an arms ban imposed on the Libyan military since the fall of former dictator Muammar Qaddafi in 2011.
In March that year, the UN Security Council passed Resolution 1970, which bars member states from providing Libya with weapons.
“Terrorism will not triumph over the Libyans’ decision to move forward towards building their state and renouncing violence," Ghassan Salame, the special representative of the UN Secretary General in Libya said.
"We will not accept any attack on a state institution, especially one committed by a terrorist group. We will work with the Libyan people to prevent terrorist groups from turning Libya into a haven or an arena for their crimes,” he said.
Libyan Interior Minister Ashour Suleiman Shuwail admitted there had been a security lapse, which he planned to overcome.
Pictures from the scene showed flames ravaging the inside of the building and two plumes of thick smoke wafting into the sky.
Fire and rescue teams eventually brought the blaze under control, but the outside of the building was charred.
The carnage from the attack and the fire which ensued means the foreign ministry will be forced to move to another headquarters.
Officials have largely been unable to halt terrorist attacks as rival governments vie for power in a political tug-of-war that has stunted attempts to stabilise and rebuild the nation that has Africa’s largest proven reserves of crude oil.
Libya descended into a period of chaos after uprisings in Tunisia and Egypt led to similar protests against Qaddafi in 2011.
In the aftermath of Qaddafi's ousting and eventual death, two rival governments and parliaments emerged: one in Tripoli led by Khalifa Haftar and the other in the eastern city of Tobruk led by Fayez Al Sarraj.
In 2015 a UN-backed deal was signed in Morocco creating the Government of National Accord, in Tripoli, but when Mr Al Sarraj arrived to set up the new administration, Mr Haftar refused to recognise it.
Peace talks in 2017 lead to a ceasefire and an agreement on elections. The two rival sides met again in May this year – weeks after ISIS suicide attackers killed 14 people at the country's electoral commission – and committed to holding parliamentary and presidential polls in December.
ISIS was forced to withdraw from towns and cities it held in Libya but proved to have a small but potent force in the country.
In June this year, a militia attacked two north-eastern oil sites under Mr Haftar's control.
Elections are to be held by spring next year and a referendum on a new constitution could take place as early as February, assuming security guarantees are met.