Gunmen on Tuesday stormed the luxurious Corinthia Hotel -- popular with world leaders and diplomats -- killing nine people including an American, a French citizen, a South Korean and two Filipinas before blowing themselves up.
The attack on such a high-profile target in the heart of Tripoli underscored the fragile security situation in the capital, which is controlled by a patchwork of militias allied with one of the two governments claiming to rule Libya.
Fajr Libya (Libya Dawn), a coalition of Islamist-led militias that installed a self-proclaimed government in Tripoli, even boasted to journalists recently that "the Islamic State has no presence" in the city.
But the attack was immediately claimed by the Tripoli branch of IS, a jihadist group that has captured large chunks of Iraq and Syria and called for the killing of citizens from US-led countries which are fighting it.
"Who carried out the attack remains an open question. I would assume the incident was a domestically driven one," James Dorsey, a senior fellow at Singapore-based S. Rajaratnam School of International Studies, told AFP.
"This was a local decision rather than taken in Raqa (in Syria) or in Iraq... You have to look at the dynamics of what is happening in Libyan politics," he said, referring to IS strongholds.
Fajr Libya took control of Tripoli in mid-2014 and is jostling for power with the internationally backed government of Prime Minister Abdullah al-Thani, which was forced to flee to the remote east.
"I think it was a local initiative... the presence of jihadists in Libya is still fragmented," said Frederic Wehrey, a Beirut-based expert on Libya at the Carnegie Endowment for International Peace.
"There is real competition, and Corinthia Hotel is an iconic symbol" representing the West, he said.
But for Mathieu Guidere, a specialist on jihadist groups, IS and its faction in Libya were merely taking advantage of the chaos in the North African country to expand.
"IS is looking everywhere to impose its strategy by taking advantage of chaos in failed states," said Guidere, professor of geopolitics at the University of Toulouse in southwestern France.
"It has already implemented it in Syria and Iraq, and now Libya seems to be an easy target for expanding its military and media strategy."
Experts say rival Islamist factions inside Libya as well as global jihadist groups have been locked in a battle for control of the oil-rich country since the toppling of former dictator Moamer Kadhafi in 2011.
"It is clear that there is internal competition among the Libyan Islamists, with Fajr Libya pitched against other militias, but also among (global) jihadists, with Al-Qaeda partisans up against those of IS," said Guidere.
"It is a leadership race that is leading to an escalation of violence in Libya."
Dorsey said the attack on the Corinthia Hotel was not just to grab headlines.
"There is a multi-layered battle in Libya, a battle between different visions of what Libya should be, a battle for power... so we don't know what really happened here," he said.
What such attacks show, however, is that "those who are in control of Tripoli are not capable of ensuring security or some level of security," Dorsey added.
The government in Tripoli said Tuesday's attack was an attempt to assassinate its chief, Omar al-Hassi, who was inside the hotel at the time of the assault.
It blamed the attack on "enemies of the revolution and the war criminal Khalifa Haftar", a former general who last year spearheaded an operation against Islamist militias in Libya's second city Benghazi.
"Hassi is just a pretext for both the sides. The government in Tripoli projects him as a victim, while those in Derna (controlled by IS) point to the chaos in Tripoli," said Guidere.
"It is a political game that benefits IS to push its pawns in Libya, as in other places."