Gunmen stormed a luxury Tripoli hotel popular with diplomats and officials Tuesday in an attack claimed by the Islamic State group, killing at least nine people -- including five foreigners -- before blowing themselves up.
The assault on such a high-profile target underlined the fragile security situation in the Libyan capital, which is controlled by a patchwork of militias allied with one of two governments claiming to rule the country.
And if it is confirmed that it was carried out by Islamic State militants it would highlight the growing reach of an extremist group with ambitions to spread its influence throughout the Middle East and North Africa.
After setting off a car bomb outside the opulent Corinthia Hotel -- where visiting world leaders have met local dignitaries in the past -- three militants rushed inside and opened fire, Issam al-Naass, a security services spokesman, told AFP.
They made it to the 24th floor of the hotel, a major hub of diplomatic and government activity, before being surrounded by security forces and detonating explosive belts they were wearing.
The head of Libya's self-declared government, Omar al-Hassi, was inside the hotel at the time but was evacuated safely, Naass said.
The dead included three security guards killed in the initial attack, five foreigners shot dead by the gunmen and a hostage who died when the attackers blew themselves up.
Naass said the foreigners killed were an American, two Filipinas, a French citizen and a South Korean. He did not give their identities.
Government officials in Washington and Paris confirmed the US and French deaths, with the American named by his company as a security contractor.
At least five people were also wounded, including two Filipina employees hurt by broken glass from the car bomb, Naass said.
The hotel's 24th floor is normally used by Qatar's mission to Libya, but no diplomats or officials were present during the assault, a security source said.
- Assassination claim -
In a statement on Twitter, the Tripoli branch of the Islamic State jihadist group claimed responsibility, the SITE Intelligence Group said.
It said the attack was in honour of Abu Anas al-Libi, an Al-Qaeda suspect who died in the United States earlier this month, days before facing a trial for bombing US embassies.
Signup to our newsletter and follow us on Facebook and Twitter!
A video posted on jihadist forums showed an image of one of the alleged perpetrators.
Security forces loyal to Hassi's government, which is jostling for power with the internationally backed authority of Prime Minister Abdullah al-Thani, surrounded the building during the assault.
The government in Tripoli said Tuesday's attack was an assassination attempt on Hassi it blamed on "enemies of the revolution and the war criminal Khalifa Haftar", a former general who last year spearheaded an operation against Islamist militias in the second city Benghazi.
Ambulances, armoured vehicles and pick-up trucks with mounted artillery could be seen around the hotel during the attack.
Security forces prevented journalists from entering the hotel afterwards, saying work was needed inside to ensure the assailants had not left behind booby traps.
- 'Blow' to peace efforts -
The UN Security Council condemned the "heinous" attack and EU foreign affairs chief Federica Mogherini called it "another reprehensible act of terrorism which deals a blow to efforts to bring peace and stability to Libya."
She expressed "solidarity with the victims and their families".
A new round of UN-mediated peace talks between Libya's rival factions kicked off in Geneva Monday as they seek to implement a roadmap on forming a unity government.
The North African nation has been wracked by conflict since the overthrow of dictator Moamer Kadhafi in a 2011 uprising, with rival governments and powerful militias now battling for control of key cities and the country's oil riches.
The Islamist-backed Fajr Libya (Libya Dawn) militia alliance took control of Tripoli last summer, forcing Thani's government to flee to the remote east.
The luxurious Corinthia was long considered a haven in a city beset by unrest, with officials, diplomats and foreign businessmen crossing paths in its lavish reception area.
In October 2013, gunmen seized then prime minister Ali Zeidan from the hotel, where he was residing. He was released after several hours.
British Prime Minister David Cameron and then-French president Nicolas Sarkozy met top officials at the hotel in September 2011, when they were the first foreign leaders to visit Libya after Kadhafi's ouster.
In Benghazi meanwhile 22 people were killed and 68 wounded in fighting since Monday evening, a security source said.