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. ||||| 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 Libyan gunmen on the government payroll seized the prime minister in his nightshirt on Thursday and held him for several hours, in a new manifestation of the anarchy that has followed the overthrow of Muammar Gaddafi. 
 
 The militia justified its bloodless dawn raid on the luxury hotel where Ali Zeidan lives under notionally tight security by saying he should be investigated for aiding U.S. forces in their capture in Tripoli on Saturday of a Libyan al Qaeda suspect. 
 
 But the liberal former diplomat has no shortage of critics among Islamist and other leaders for his failure to resolve strikes that have paralyzed oil exports or to impose order since he was elected premier a year ago by the interim legislature. 
 
 A morning of negotiations while Zeidan was held at an Interior Ministry office by a group employed by the state to provide security in Tripoli ended with him being freed unharmed and then pointedly avoiding criticism of his erstwhile captors. 
 
 He called for "wisdom" and national unity and praised former anti-Gaddafi rebel groups for helping secure his release. Underlining the sense of chaos generated by such forces, still under arms two years after Gaddafi fell, members of the militia which seized Zeidan tried to deny their group's involvement. 
 
 "His kidnapping clearly indicates that his government is not cohesive, and that not only is his government not in control of the country, but that he is not in control of his government," said Geoff Porter of North Africa Risk consulting. 
 
 World oil prices rose more than 1 percent on speculation that Libyan crude experts would not quickly return to normal after weeks of disruption. Able to supply about 2 percent of world demand, and also a big supplier of gas to Europe, Libya's six million people can look forward to considerable prosperity, but rivalries over control of resources has hampered investment. 
 
 SECURITY VACUUM 
 
 The killing 13 months ago of the U.S. ambassador during an Islamist attack on Washington's consulate in Benghazi drew world attention to Libya's problems. But daily confrontations, including sieges in recent months of government ministries and oil installations, have posed greater problems for its rulers. 
 
 U.S. Secretary of State John Kerry said Zeidan's abduction showed the need to built the capacity of the Libyan state, whose formal armed forces, made up of ex-Gaddafi troops and some of his enemies, have proven no match for mobile squads of gunmen riding pickup trucks bristling with heavy weaponry. 
 
 In France, which took a lead in backing the 2011 uprising, President Francois Hollande said: "We already had great concerns about the situation in Libya and what happened to the prime minister has reinforced those worries." 
 
 Hollande sent French troops into Mali early this year to confront an Islamist revolt in its former colony that was fed by arms and fighters from Libya. He said on Thursday Paris was ready to increase cooperation with the Libyan authorities to prevent it being a haven for militants. "We must be there to cooperate with Libya to put an end to these groups," he said. 
 
 British Prime Minister David Cameron said he had called Zeidan to offer further support to stabilize Libya. 
 
 Libyans, especially from the restive east, far from Tripoli, formed a significant component of al Qaeda and other fighters while Gaddafi was in power. Some benefited from asylum in the West as opponents of Gaddafi. Some, too, were sent back to face torture in his jails after he made peace with the West. 
 
 The fall of the veteran ruler, who was killed in fighting on October 20, 2011, encouraged some radical Islamists to return home, while others emerged from prison. 
 
 Some of these are now cooperating with other groups in Africa, worrying Western powers who see an increasing Islamist threat, from Nigeria in the West, through the Sahara desert, to the likes of Somalia's al Shabaab in the east - the group behind a bloody attack on a shopping mall in Kenya last month. 
 
 ISLAMIST ANGER 
 
 The incident, which follows days of Islamist anger at the U.S. raid which snatched al Qaeda suspect Abu Anas al-Liby, also highlighted the dilemmas facing Libya's government in relations with the United States and other Western powers which provided the air power that helped them end Gaddafi's 42-year rule. 
 
 Zeidan, who lived in exile in Geneva after defecting from Gaddafi's diplomatic service three decades ago, had expressed surprise and annoyance about the U.S. operation - distancing himself as Islamists vowed reprisals against U.S. interests. 
 
 But that failed to convince his critics, who said they took Zeidan into custody because Kerry had said the Libya government had been informed of the mission which seized Liby outside his house and flew him to a U.S. warship for questioning. 
 
 Zeidan made no mention of the issue after his release. 
 
 The group which bustled him from the seafront Corinthia Hotel, a heavily guarded complex housing diplomats and senior government officials, was the Operations Room of Libya's Revolutionaries, which has criticized Zeidan in recent weeks. 
 
 Though photographs circulating on social media showed Zeidan apparently at ease with his smiling captors on Thursday, the Operations Room's spokesman, Abdulhakim Belazzi, had last week launched a bitter tirade about the prime minister on television. 
 
 "What have you done for Libya?" he shouted. "You took control at a time when Libya was moving forward and developing. 
 
 "Now you've destroyed everything." 
 
 A visit by Zeidan last week to neighboring Egypt, where the Muslim Brotherhood government was ousted by the army in July, also angered Libyan Islamists who accused the prime minister of endorsing the overthrow of President Mohamed Mursi. 
 
 Zeidan was among those who persuaded French and British leaders to support the 2011 revolt against Gaddafi. Last month, on a visit to London, he appealed for more Western support to rein in the former rebels. 
 
 After the Arab Spring revolts that ousted several autocratic leaders, Libya's transition has been one of the messiest. 
 
 It still has no new constitution, Zeidan faces a possible vote of no confidence and its transitional assembly, the General National Congress, is paralyzed by divisions between the secular National Forces Alliance and the Muslim Brotherhood. 
 
 "Is this a wake up call?" asked one Western diplomat. "Will it frighten the political class into understanding that they can't carry on squabbling and that they have to work together?" 
 
 (Additional reporting by Yara Bayoumy in Cairo, John Irish in Paris and Patrick Markey in Tunis; Writing by Alastair Macdonald)
– 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."