Responders rescue an attack victim in a previous bombing in Somalia. [File, Standard]

Eight people were killed after militants stormed a hotel in Somalia's port city of Kismayo, an attack that started with a suicide bombing Sunday before gunmen forcibly entered and exchanged fire with security forces.

The Islamic extremist group al-Shabab claimed responsibility for the attack, saying its fighters had penetrated the Tawakal Hotel.

Security forces from the southern Somali state of Jubaland later ended the siege, killing the gunmen and rescuing scores of people, state media reported.

There was no official word on casualties, but a doctor at Kismayo Hospital told The Associated Press saw the bodies of eight dead people, four of whom were security personnel.

At least 41 people were wounded in the attack, the doctor said, speaking on the condition of anonymity because he was not authorized to divulge such information.

Journalists were prevented from getting close to the scene of the attack. Footage shared on social media showed ambulances collecting the wounded from outside the hotel in central Kismayo.

The city is located about 500 kilometers (310 miles) from the Somali capital, Mogadishu.

The attack began when a car driven by a suicide bomber rammed the entrance gate of the hotel and then exploded, police officer Abshir Omar said by phone. A number of small businesses along the street were destroyed.

Some government officials and traditional elders were eating lunch in the hotel at the time of the explosion, he said.

Mohamed Nasi Guled, a senior police official in Jubaland, said three attackers entered the hotel's premises.

The hotel is popular as a meeting place for government officials. Al-Shabab is believed to have a strong presence in the areas surrounding Kismayo, the largest city and commercial capital of Jubaland.

Al-Shabab, which has ties with al-Qaida, regularly carries out attacks in the Horn of Africa nation. Many of the group's attacks target popular hotels.

Al-Shabab opposes the Mogadishu-based federal government, which it perceives as a puppet of foreign governments. The group also opposes the presence of foreign troops in Somalia.