Suicide attackers on Tuesday stormed the Libyan foreign ministry in the capital Tripoli, killing at least three people including a senior civil servant, the authorities said, according to AFP.
21 other people were wounded in what authorities said was a suicide attack carried out by "terrorists".
A car bomb exploded near the ministry, prompting security forces to rush to the scene, said special forces spokesman Tarak al-Dawass.
A suicide bomber then blew himself up on the second floor of the building while a second attacker died when a suitcase he was carrying exploded, he added.
A third assailant, who was unarmed and wearing a bulletproof vest, was killed by security forces outside, said Dawass.
The Islamic State (ISIS) jihadist group later claimed responsibility for the attack, according to Reuters.
The group said in its propaganda news agency, Amaq, that three of its members carried out the attack.
Foreign Minister Tahar Siala said one of the dead was senior diplomat Ibrahim al-Shaibi who headed a department in his ministry.
Libya has been rocked by chaos since the 2011 uprising that toppled and killed dictator Muammar Qaddafi, with two rival authorities and multiple militias vying for control of the oil-rich country.
As a result, the country has become a haven for jihadists and has experienced multiple terrorist attacks in recent years.
ISIS took advantage of the chaos to gain a foothold in the coastal city of Sirte in 2015.
Forces loyal to the UN-backed Government of National Accord (GNA) regained control of Sirte in December 2016 after eight months of deadly fighting.
Since then, some jihadists have returned to the desert in an attempt to regroup and reorganize.
Last year, the Libyan jihadist group Ansar al-Sharia, which is accused by Washington of the 2012 attack on the U.S. consulate in Benghazi that killed the ambassador and three other Americans, announced its "dissolution".
Ansar al-Sharia is one of the jihadist groups that sprung up in Benghazi in the chaos following the death of Qaddafi. Members of the group overran the city in 2014 and later declared authority over the coastal city of Darna.
Most of Ansar al-Sharia’s members have defected to ISIS in recent years.