Militants have attacked a hotel used by foreigners in Libya’s capital, killing at least four people and injuring 12 others, officials say.
Several gunmen stormed the Corinthia Hotel in Tripoli and opened fire in the reception area. A car bomb also exploded outside the hotel.
Unconfirmed reports say some of the assailants have blown themselves up and that foreigners are among the dead.
The security forces say the stand-off has now been brought to an end.
Reports conflict as to whether any foreigners were killed and over the total number of attackers.
A Twitter account linked to Islamic State said the militant group had carried out the attack.
Correspondents say it is difficult to assess whether IS has a presence in Libya.
Extremists have been blamed for a string of bombings over the last month.
A civilian who witnessed the attack told the BBC: “I suddenly heard shots and saw people running towards me, and we all escaped from the back [of the hotel] through the underground garage. The hotel did a lockdown after that.”
Different sources at the scene said there were between three and five attackers – video footage released later on Tuesday showed the body of a man reported to be one of the militants.
A security source told the BBC that one gunman had been arrested.
Officials initially said three security guards had been killed by the car bomb blast, with the number rising to four later on Monday.
But a local official was later quoted by the Reuters news agency as telling local TV that at least eight people, including five foreigners, had been killed in the attack.
A number of foreign companies have makeshift offices in the hotel, the BBC’s Rana Jawad in Tripoli says, and housing the few foreigners who remain in the Libyan capital has always been known to be at risk.
One hotel employee told the Associated Press news agency that the hotel was mostly empty at the time of the attack.
Meanwhile, a hotel security source told the BBC that the hotel had received a threat “a few days ago” warning managers “to empty the building”.
The Corinthia Hotel is used by foreign diplomats and government officials. The UN Support Mission in Libya (Unsmil) has hosted several workshops at the hotel.
Libyan Prime Minister Abdullah Al-Thinni condemned the attack and pledged that those responsible for it would be brought to justice.
Federica Mogherini, the EU’s foreign affairs chief, also condemned the attack which took place as a second round of peace talks between Libya’s warring factions ended in Geneva in what the UN described as a “positive atmosphere”.
The Twitter account linked to IS said the group had carried out the attack in revenge for the death of Abu Anas al-Liby, a Libyan jihadist who was suspected of involvement in the bombings of two US embassies in East Africa in 1998.
Liby died in a US hospital on 2 January, days before he was due to stand trial.
A number of attacks in the country have been claimed by social media accounts purporting to represent the jihadist group.
Libya has been hit by instability since the overthrow of long-time ruler Col Muammar Gaddafi in October 2011.
Numerous militias govern their own patches of territory, with successive governments struggling to exercise control.