A car exploded in the hotel parking lot, although it was unclear whether the cause was a bomb, a rocket-propelled grenade or some kind of missile. Local officials said later that at least one of the assailants had killed himself with a grenade or a suicide vest. 
 
 The hotel, one of the most luxurious in Tripoli, the capital, is a hub for foreign tourists and businesspeople visiting Libya, and it also houses the offices of several foreign embassies. But most foreigners have fled as the country has descended into chaos and armed conflict since last summer. Libyans who do business in the hotel said it was largely empty when the attack began. 
 
 Photo 
 
 An unidentified hotel employee told The Associated Press that guests, including British, Italian and Turkish visitors, had fled out the back as the attackers entered the lobby. There were initial reports that some of the attackers had taken hostages. By midday, however, security officials interviewed on Libyan television said that there were no hostages and that at least two of the attackers had been killed. 
 
 A group calling itself the Tripoli Province of the Islamic State, the extremist group that has seized territory in Syria and Iraq, issued a statement on social media taking responsibility for the attack just as it was beginning, and the timing added credibility to the claim. The group portrayed the assault as retaliation for the abduction last year by American commandos of a Libyan Qaeda operative, Nazih Abdul-Hamed al-Ruqai, also known as Abu Anas al-Libi. 
 
 Mr. Ruqai, 50, died this month in a New York hospital of complications from liver surgery as he was waiting to stand trial for a role in the Qaeda bombings of the American Embassies in Kenya and Tanzania in 1998. 
 
 Accompanying a picture of smoke rising from the hotel parking lot, the statement called the attack “an inside operation” by “the heroes of the caliphate,” and called the hotel a “headquarters that includes diplomatic missions and the crusader security companies.” The group later released the names and pictures of at least two fighters it said had been killed during the attack, one Tunisian and one Sudanese. 
 
 Libya has struggled to build a coherent and functional government to replace the one led by Colonel Qaddafi. Regional and ideological militias have battled for power and territory, often competing to coerce or intimidate the feeble institutions of the transitional government. Last summer, the rival militias broke into two warring coalitions based on opposite sides of the country. 
 
 Advertisement Continue reading the main story 
 
 Tripoli has come under the control of a coalition calling itself Libya Dawn, which includes moderate Islamist politicians, extremist Islamist fighters, the powerful militias from the city of Misurata and ethnic Berber groups in the West. Proclaiming its own “government of national salvation,” the Dawn coalition’s government rested its claims to legitimacy on the rump of a disbanded transitional Parliament reconvening in Tripoli. 
 
 Opponents of the Libya Dawn coalition routinely refer to it as a terrorist collaborator, happy to cooperate with extremists like Ansar al-Shariah, the Benghazi group linked to the killing of Ambassador Stevens, or the Islamic State, also known as ISIS or ISIL. 
 
 The attack on the Corinthia tested Libya Dawn’s leadership, all but forcing it to either denounce some of its militant allies or appear to countenance the violence. 
 
 300 miles Mediterranean Sea TUNISIA Tripoli EGYPT LIBYA NIGER CHAD 
 
 Instead, the Libya Dawn’s Tripoli government tried to dodge the question, denying that the local Islamic State group was responsible and attempting, implausibly, to blame Qaddafi loyalists or the rival faction. 
 
 It was “elements of the old regime,” Omar Khadrawi, a Tripoli security official, said on Libyan television, accusing Qaddafi loyalists of “tampering with the security situation that Tripoli is blessed with.” 
 
 In a statement, the Libya Dawn government in Tripoli called the attack an attempt to assassinate its prime minister, Omar al-Hassi, who resides in the hotel but evacuated safely as the attack began. 
 
 Newsletter Sign Up Continue reading the main story Please verify you're not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up You agree to receive occasional updates and special offers for The New York Times's products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters. 
 
 “Fingers point at the enemies of the revolution” and the military leader of the rival faction, the statement said. 
 
 The rival coalition, under the banner Operation Dignity, is now based in the Eastern cities of Tobruk and Bayda, but it includes fighters from the Western city of Zintan, along with fighters and officers who were loyal to Colonel Qaddafi and those who renounced him. Its military effort is led by Gen. Khalifa Hifter, who tried last year to stage a military takeover, promising to rid Libya of Islamists. 
 
 Under his protection, the leaders and a slight majority of a new Parliament elected last year have moved from Tripoli to Tobruk, where they have lent formal legitimacy to his battle against Libya Dawn and its allies. 
 
 Advertisement Continue reading the main story 
 
 In a statement on Monday, the Tobruk-Bayda government said that the Libya Dawn forces in Tripoli “ally themselves with extremist groups who use violence to achieve political aims.” It said the attack demonstrated “the increasing levels of violence affecting civilians in Tripoli” under Libya Dawn. 
 
 In the chaos, three Libyan militant groups have pledged loyalty to the Islamic State — one based in Derna in the east, one based in the southern desert and the group based in the region around Tripoli that carried out the attack. 
 
 In December, the Tripoli group claimed responsibility for a bombing near the headquarters of the Foreign Ministry, in retaliation for a senior official’s Merry Christmas message, which the group deemed heretical. It has also claimed responsibility for the kidnapping of about 20 Egyptian Christians who were in Libya as migrant workers in the coastal city of Surt. ||||| TRIPOLI, Libya (AP) — A Libyan affiliate of the extremist Islamic State group claimed responsibility Wednesday for an attack on a Tripoli luxury hotel that killed 10 people, including an American and four Europeans. 
 
 In this image made from video posted by a Libyan blogger, the Cortinthia Hotel is seen under attack in Tripoli, Libya, Tuesday, Jan. 27, 2015. Gunmen stormed the luxury hotel in the Libyan capital of... (Associated Press) 
 
 The group, calling itself "Islamic State in Tripoli Province," said it launched the attack Tuesday to avenge the death of Abu Anas al-Libi, who was snatched off a Tripoli street by U.S. special forces in 2013 and died in U.S. custody earlier this month due to complications from liver surgery. Al-Libi had been indicted in U.S. federal court over his alleged role in the 1998 al-Qaida bombings of U.S. embassies in Kenya and Tanzania. 
 
 The group identified the attackers as Abu Ibrahim al-Tunsi and Abu Suleiman al-Sudani, noms de guerre that suggest the attackers were Tunisian and Sudanese. The claim of responsibility was dated Tuesday but first appeared on jihadi forums Wednesday. 
 
 "The operation is not the last one on the lands of Tripoli... Let the enemies of God, the crusaders and their allies await what would harm them," the message read. 
 
 The affiliate previously claimed responsibility for an attack on the Algerian Embassy that wounded three guards. It also previously posted pictures of fighters touring markets and distributing pamphlets. Wednesday's posting matched previous messages posted on Twitter and social media, but it was not immediately possible to confirm the claim. 
 
 Since the 2011 uprising that ousted longtime dictator Moammar Gadhafi the country has been awash in armed militias, including several Islamic extremist groups. A group of Islamist militias control Tripoli, and the internationally recognized government convenes in the far east of the vast, oil-rich country. 
 
 In addition to the foreigners, five guards were killed in the attack Tuesday on the seaside Corinthia Hotel. Two attackers were killed following an hourslong standoff that included a car bombing. 
 
 A senior U.S. State Department official confirmed that an American citizen was among those killed. Cliff Taylor, the CEO of a Virginia security company, Crucible LLC, identified the slain American as David Berry, a contractor with his company. 
 
 The online message said that those killed were American, French, South Korean and Filipino. Earlier, Essam al-Naasa, a spokesman for a Tripoli security agency, said the dead included an American, a French citizen and three others from the former Soviet Union. ||||| The attack, which included a car bombing, struck the Corinthia Hotel, which sits along the Mediterranean Sea. 
 
 Mahmoud Hamza, commander of the so-called Special Deterrent Force, told private satellite television station al-Nabaa that the situation was "under control" Tuesday afternoon, though he couldn't confirm the whereabouts of the gunmen. He also said five foreigners were killed, without elaborating. 
 
 Another security official earlier said the gunmen killed three guards and took hostages, but had no further information on the captives' identities. He also said that two commercial landmark towers behind the hotel were evacuated out of security concerns. He spoke on condition of anonymity because he was not authorized to speak to reporters. 
 
 A hotel staffer said the attack began when five masked gunmen wearing bulletproof vests stormed the hotel after security guards at the hotel's gate tried to stop them. He said they entered the hotel and fired randomly at the staff in the lobby. 
 
 The staffer said the gunmen fired in his direction when he opened his door to look out. He said he joined the rest of the staff and foreign guests fleeing out the hotel's back doors into the parking lot. 
 
 When they got there, he said a car bomb exploded in the parking lot, only a hundred meters (yards) away. He said this came after a protection force entered the lobby and opened fire on the attackers. He said two guards were immediately killed. The staffer spoke on condition of anonymity because he feared being targeted later by militants. He said the car bomb left at least five cars in the parking lot burned and damaged some windows in the hotel's facade. 
 
 He said the hotel had Italian, British and Turkish guests, but the hotel was largely empty at the time of the attack. He said the militia-backed Prime Minister Omar al-Hassi usually resides at the hotel, but was not there Tuesday. Al-Hassi's security guards also weren't there, he said. The hotel previously came under attack in 2013 when a former prime minister was abducted there. 
 
 Since the ouster and 2011 killing of Libyan dictator Moammar Gadhafi, the country has been torn among competing militias and tribes vying for power. Libya's post-Gadhafi transition has collapsed, with two rival governments and parliaments — each backed by different militias — ruling in the country's eastern and western regions. Tripoli has been hit with series of car bombs and shootings amid the turmoil. 
 
 The Malta-owned hotel is also where the United Nations support mission in Libya holds its meetings. The mission is currently hosting political talks with rival Libyan groups in Geneva.
– More details are emerging in yesterday's deadly attack on a luxury hotel in Tripoli. Four or five gunmen are believed to have entered the Corinthia in the early morning, shouting "God is great" as they fired at guards and civilians. Ten people were killed, including American David Berry, an ex-Marine and contractor with security company Crucible, and four Europeans, the New York Times reports. The AP adds the "Islamic State in Tripoli Province," a Libyan affiliate of ISIS, has claimed responsibility for the assault, seen as retaliation for the death of alleged al-Qaeda leader Abu Anas al-Libi in US custody. Al-Libi, seized by US forces in Tripoli in 2003, died earlier this month of complications from liver surgery. Five guards were also killed in the chaos, which the Times calls the "deadliest attack on Western interests in Libya since the assault on the American diplomatic mission in Benghazi." A hotel employee tells the AP that British, Italian, and Turkish guests fled out a back entrance to a parking lot, where a car bomb exploded 100 yards away. No hostages were taken. Two of the assailants were killed after an hours-long standoff with police loyal to the Tripoli government; one is believed to have killed himself with a grenade or suicide vest. "The operation is not the last one on the lands of Tripoli," a post on jihadi forums today reads. "Let the enemies of God, the crusaders, and their allies await what would harm them."