Somali government officials have said they have taken control of the hotel where gunmen were holed up for more than 12hours in an attack that has left at least 17 people dead.

Captain Mohamed Hussein said on Saturday the gunfire had stopped and security agents have accessed the whole building. Hussein had earlier said the gunmen were believed to have occupied the third and fourth floor of the the Maka Al-Mukarramah hotel in the capital Mogadishu.

Al-Shabab, an al-Qaeda-linked armed group that has carried out many attacks in Somalia, claimed responsibility for the assault on the hotel,which is popular with Somali government officials and foreigners.

After the gunmen's initial attack on Friday, government troops managed to take up the first floor of the hotel. The gunmen were believed to be on the third and fourth floor, Hussein said.

Hussein said the attackers were hurling grenades at the Somali special forces. The African Union Mission In Somalia, or AMISOM, posted on Twitter that there were reports of possible hostages but Al Jazeera could not independently verify them.

The attack started when a suicide bomber detonated his explosives-laden car at the gate of the hotel. Gunmen then quickly moved in.

Hours later, the gunmen were still holed up in the hotel's dark alleys and rooms. Sporadic gunfire could be heard, but it appeared that the security forces would wait until daybreak before trying again to dislodge the fighters.

Al-Shabab routinely carries out suicide bombings, drive-by shootings and other attacks in Mogadishu, the seat of Somalia's Western-backed government - often targeting government troops, lawmakers and foreigners.

The groups controlled much of Mogadishu between 2007 and 2011, but was pushed out of Somalia's capital and other major cities by African Union forces.

Despite major setbacks in 2014, al-Shabab continues to wage a deadly campaign against Somalia's government and remains a threat in the East African region.

The group has carried out attacks in neighbouring countries, including Kenya, whose military is part of the African Union troops bolstering Somalia's weak government.

At least 67 people were killed in a September 2013 attack by al-Shabab on a mall in Nairobi, the capital of neighbouring Kenya.

[Mustaf Shafana/Al Jazeera]
[Mustaf Shafana/Al Jazeera] 

Source: AP