MogadishuHotelAttack_June22016
Somali forces take positions at Hotel Ambassador on Maka Al Mukaram Road in Somalia's capital Mogadishu on June 2, 2016. REUTERS/Feisal Omar

Somali security forces have brought to an end a bomb and gun attack by militants on a central Mogadishu hotel that killed at least 16 people and wounded 55, authorities said on Thursday.

Islamist militant group al Shabaab, affiliated with al Qaeda, claimed responsibility for Wednesday's attack on Hotel Ambassador. Two lawmakers were among the dead in the attack which ended with police shooting the assailants.

"So far we have confirmed 16 people, mostly civilians, died and 55 others were injured," Major Nur Mohamed, a police officer, told Reuters on Thursday.

Another police officer, Major Farah Ali, told Reuters the hotel was now secure after the entire building was cleared of militants.

"National security forces are in every floor, the last fighter on the top roof (was) shot," Ali said.

A Reuters witness saw the last fighter shot dead, his body falling to the ground from the building's fifth floor. Eight dead people lay in front of the hotel.

Al Shabaab was pushed out of Mogadishu by the African Union peacekeeping force AMISOM in 2011. But it has remained a potent threat in Somalia, launching frequent attacks aimed at overthrowing the Western-backed government.

The group has also been behind deadly attacks in Kenya and Uganda. Both contribute troops to an African Union peacekeeping force in Somalia.

Sheikh Abdiasis Abu Musab, al Shabaab’s military operations spokesman, told Reuters they had lost three fighters during the hotel attack and killed 30 people.

One of the three dead fighters drove the car that rammed the hotel while the others stormed the hotel, al Shabaab said.

Death tolls given by al Shabaab are usually much higher than those given by officials.

"We killed 30 apostates including MPs and soldiers....the operation was victorious as planned," Abu Musab said, adding they had injured 60 during the assault.

Earlier, Reuters witnesses said sporadic gunfire had continued at the hotel early Thursday morning, with Police still combing the building's five floors for militants and to rescue those still trapped.

A man on the hotel's top floor was heard by a Reuters witness crying out: "Please rescue me."

The building was extensively damaged during the attack and government forces had blocked off all the main roads near the scene.