MOGADISHU (Reuters) - Security forces in the Somali capital fought for several hours on Sunday before clearing a hotel of Islamist al Shabaab gunmen who had stormed the building after two bombs ripped into it, police and witnesses said. At least 13 people were killed.

A general view shows Somali policemen holding their position during an exchange of fire with Islamist al Shabaab gunmen outside a Sahafi hotel in Somalia's capital Mogadishu, November 1, 2015. REUTERS/Feisal Omar

Al Shabaab, which has frequently launched attacks in Mogadishu in its bid to topple the Western-backed government, said it was behind the assault on the Sahafi hotel, where government officials and lawmakers stay.

“Mujahideen (fighters) entered and took over Sahafi hotel where enemies lived,” Sheikh Abdiasis Abu Musab, al Shabaab’s military operations spokesman, told Reuters.

The incident mirrored tactics used before by al Shabaab, in which it detonates bombs to break through security at targets and then sends in fighters.

The government is battling to rebuild the Horn of Africa nation after more than two decades of conflict. Al Shabaab ruled much of Somalia until 2011, when it was driven out of Mogadishu by African and Somali troops. It remains a potent force.

Major Ahmed Nur, a police officer, told Reuters that a car bomb rammed the entrance to the hotel and was followed by a second blast, which a security guard said was another vehicle bomb.

After a gun battle lasting several hours, he said the hotel had been cleared of gunmen. “The hotel has been entirely secured,” Nur said, putting the death toll so far at 13.

Police said those killed included the hotel owner, a lawmaker, a former senior military commander, a radio journalist and other civilians.

“We have also rescued many government officials by a ladder through the back wall,” said Major Ismail Nur, another police officer, after the assault that was launched around dawn.

One police officer said fighters had fired on them from the rooftop. The African Union’s AMISOM force, leading a campaign with Somali troops against al Shabaab, also helped to clear the hotel.

An AMISOM spokesman had earlier said they were “mopping (up) floor by floor” in the four-storey building.

The hotel is near a busy area in Mogadishu known as K-4. Plumes of smoke rose above the capital, on the Indian Ocean coast. “We got phone calls from staff hiding in hotel rooms saying that there are several injured people in the hotel,” Ismail Nur said as fighting still raged.

A Reuters witness saw wrecked cars and motorbikes in the area, as well as two dead civilians lying outside. At least three others were injured.