Islamic State-linked members have shared a picture on Twitter of one of the alleged gunmen who attacked a luxury hotel in the Libyan capital of Tripoli.

Abu Ibrahim al-Tunsi, a Tunisian, reportedly set off a car bomb outside the Corinthia Hotel in Libya's capital along with two or three other armed militants and then made it to the 24th floor of the hotel, a major hub for diplomatic and government activity in Tripoli, before being circled by security forces. Then, they blew themselves up, according to Reuters reports.

Three security guards, five foreigners and a hostage were killed in the attack, according to Issam al-Naass, a spokesman for the security services.

A group linked to IS and calling itself the Tripoli province of the Islamic State, issued a statement on Twitter claiming responsibility for the deadly assault.

The group said the attack was in retaliation for the abduction by US forces of a Libyan al-Qaeda operative, Nazih Abdul-Hamed al-Ruqai, also known as Abu Anas al-Libi.

Al-Libi died earlier this month in New York after complications following liver surgery. He was due to stand trial for a role in the jihadists' bombings of the American embassies in Kenya and Tanzania in 1998. The statement called the attack "an inside operation" by "the heroes of the caliphate". It also called the hotel a headquarters that includes diplomatic missions and the crusader security companies.

The claim could not be independently verified.