Libya hotel attack: Five foreigners among nine killed
Militants have attacked a hotel in the Libyan capital Tripoli, killing at least nine people including five foreigners, officials say.
Several gunmen stormed the Corinthia Hotel and opened fire in the reception area. A car bomb also exploded nearby.
Unconfirmed reports say some of the assailants have blown themselves up. The officials say the dead include one US and one French citizen.
The security forces say the stand-off has now been brought to an end.
The US state department has confirmed the death of a US citizen, without giving any further details. The dead American is believed to have been a security contractor.
The French national is reported to have been working for Libya's Buraq Air.
There are conflicting reports as to the total number of attackers.
A Twitter account linked to Islamic State said the militant group had carried out the attack.
There has been strong evidence to suggest an IS presence in the eastern Libyan city of Derna since October, with a group there publicly declaring allegiance to its leader Abu Bakr al-Baghdadi.
However, the command structure is still a mystery to most foreign observers.
The BBC's Rana Jawad in Tripoli says that in the past month there has been a string of incidents in western Libya, including abductions and bombings, that have been claimed by IS social media accounts.
But she says it has not been clearly established whether these groups are IS foot soldiers or people inspired by them.
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."
Analysis: BBC's Rana Jawad in Tripoli
The militant group Islamic State has claimed responsibility for the attack on the Corinthia Hotel, which was housing Omar al-Hassi, prime minister of Tripoli's self-proclaimed government, and the makeshift offices of an unknown number of foreign companies. Although this cannot be verified with absolute certainty, the brutality and style of the siege suggests it was the work of extremists targeting foreigners.
Libya is in a state of political chaos with a security vacuum and there are few reliable sources with whom to check facts. On a day when Tripoli witnessed this brazen and deadly attack, reporters were faced with statements from competing political blocs who seemingly tried to capitalise on the incident.
Mr al-Hassi claimed he was the target. The elected government in the east will use it to make the case for broadening their crackdown on Islamist groups - which some blame for further radicalising some of them.
What it has shown is that this lawless land is making it easy for extremist groups to mushroom.
Different sources at the scene said there were between three and five attackers - 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. Four security guards are among the dead and several people are reported to be injured.
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".
Housing the few foreigners who remain in the Libyan capital has long been known to be risky, our correspondent says.
The Corinthia Hotel is used by foreign diplomats, government officials and foreign companies. The UN Support Mission in Libya (Unsmil) has hosted several workshops at the hotel.
Libyan internationally recognised 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.
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 competing governments in Tripoli and the east struggling to exercise control.