Gunmen stormed a luxury hotel in Libya's capital, killing at least 11 people, including three guards and five foreigners, before blowing themselves up after being surrounded by security, officials said.

The attack, which included the use of a car bomb, struck the popular Corinthia Hotel, which sits along the Mediterranean Sea and is a major hub for diplomatic and government activity in Tripoli.

Mahmoud Hamza, commander of the so-called Special Deterrent Force, told private satellite television station al-Nabaa that the situation was "under control'' by Tuesday afternoon.

The government in Tripoli said the attack's target was Prime Minister Omar al-Hassi, who normally resides at the hotel but was not there at the time. Spokesman Amr Baiou said Hassi was unharmed, the AP news agency reported.

The incident today sends a message that Tripoli is not secure.

Mary Fitzgerald, journalist

A senior US State Department official confirmed that a US citizen was among those killed in the attack, but did not provide further details. 

Cliff Taylor, the CEO of a Virginia security company, Crucible LLC, identified the slain American as David Berry, a contractor with his company.

A French national and three citizens of a former Soviet republic also were killed, said Issam al-Naass, a spokesman for a Tripoli security agency.

US nationals rescued

Naass later told the AFP news agency that the gunmen blew themselves up after being surrounded on an upper floor.

"After being pursued and surrounded on the hotel's 24th floor, the attackers detonated explosive belts they were wearing," Naass said.

He said an investigation was under way and the car used by the gunmen is believed to be the same one used in an assault on the Algerian Embassy 10 days ago that wounded three guards.

According to security sources at the scene, the attack began when four armed men detonated a car bomb in front of the hotel, killing a guard, before rushing inside.

Al Jazeera's Mahmoud Abdelwahed, reporting from the scene in Tripoli, said security forces had rescued eight US nationals.

"We know [the gunmen] entered the hotel and then went straight to the upper floor. They used hand grenades and AK47s."

Libya is mired in conflict between two rival governments - an internationally recognised one based in eastern Libya and a rival administration set up in Tripoli after an armed faction called Libya Dawn took over the capital.

The attack comes as a new round of UN-mediated peace talks between Libya's rival factions started in Geneva on Monday as they seek to implement a roadmap on forming a unity government.

Mary Fitzgerald, a journalist reporting from Libya, told Al Jazeera: "The incident today sends a message that Tripoli is not secure." 

"This will undermine the message that they are trying to send," she said, referring to the government based in the Libyan capital.

'Reprehensible act'

In a brief statement on Twitter, the Tripoli branch of the Islamic State of Iraq and the Levant (ISIL) group claimed the attack, the SITE Intelligence monitoring group said.

A security official in Tripoli, Omar al-Khadrawi, told the AP news agency that initial investigations pointed to a group of former Gaddafi loyalists being behind the assault.

The UN Security Council condemned the attack "in the strongest terms" and urged all countries to help bring "the perpetrators, organisers, financiers and sponsors of these reprehensible acts of terrorism to justice."

In a statement approved by all 15 members, the council also urged all parties in Libya "to engage constructively" with UN envoy Bernardino Leon and resume "an inclusive political process aimed at addressing the political and security challenges" facing Libya.

EU foreign affairs chief Federica Mogherini called the attack "another reprehensible act of terrorism which deals a blow to efforts to bring peace and stability to Libya."

She expressed "solidarity with the victims and their families" but provided no details of casualties.

"Such attacks should not be allowed to undermine the political process," Mogherini said in a statement.

Source: Al Jazeera and agencies