A U.S. citizen was among nine killed when gunmen stormed a luxury hotel in the Libyan capital of Tripoli on Tuesday, a senior State Department official said.

The attack on the Corinthia Hotel, which sits along the Mediterranean Sea, triggered an hours-long standoff that ended when two assailants set off a grenade that killed them, officials said. Four foreigners and five guards were killed in the attack.

The State Department official didn't provide additional details. The U.S. citizen, who worked for Team Crucible LLC, a security training and operations firm based in Federicksburg, Va., was identified Tuesday afternoon as David Berry, the company said. He had a U.S. military background, though a company executive declined to provide additional information.

But The New York Times reported that the militants had claimed allegiance to the Islamic State terror group.

The attack started in the morning hours and included a car bombing, said Essam al-Naas, a spokesman for a Tripoli security agency.

More On This...

Libya's security forces responded and after several hours of a standoff, the attackers threw a grenade at the security forces, killing themselves and a security guard. Ten people were also wounded in the attack, including security guards and guests.

"The operation is over," al-Naas said but added that the streets around Corinthia remained closed. He said an investigation was underway.

Earlier in the day, Mahmoud Hamza, commander of the so-called Special Deterrent Force, told private satellite television station al-Nabaa that five foreigners were killed, without elaborating, but al-Naas later revised the casualty toll.

It was not clear if the two assailants were the only ones involved in the attack.

As the standoff developed, a security official said the gunmen had taken hostages, though he had no further details. Two commercial landmark towers behind the hotel were evacuated out of security concerns, he said, speaking on condition of anonymity because he was not authorized to speak to media.

Since Al-Qaddafi's ouster, Libya has been torn among competing militias and tribes vying for power. The post-Al-Qaddafi transition has collapsed, with two rival governments and parliaments — each backed by different militias — effectively ruling in the country's eastern and western regions.

The militia-backed government in Tripoli said the target of the attack was Prime Minister Omar al-Hassi. Spokesman Amr Baiou told reporters al-Hassi was unharmed.

Reports about the attack itself were conflicting and it was not immediately possible to reconcile the different accounts.

A hotel staffer initially said that five masked gunmen stormed the Corinthia after security guards at the hotel's gate tried to stop them. He said the assailants 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, the staffer 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.

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 was largely empty at the time of the attack, the staffer added. He said 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.

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, trying to resolve the country's political and security crisis.

Amid months of violence, Libya's elected parliament was forced to relocate to the far-eastern city of Tobruk after the Islamist-allied militias seized Tripoli and the second-largest city of Benghazi. The internationally-recognized Cabinet meets in Bayda, also in the east.

Fox News' Michelle Macaluso, Lucas Tomlinson and The Associated Press contributed to this report.