MOGADISHU (Reuters) - An Islamist attack on a hotel in Mogadishu ended on Sunday after 29 people were killed during a siege lasting nearly 12 hours, police said, prompting the government to sack two top security officials over their failure to stop repeated attacks.

The attack proved once again that insurgents can carry out deadly assaults in the heart of the Somali capital. Twin bombings in Mogadishu two weeks ago killed more than 350 people, the worst such attacks in the country’s history. More than 50 people are still missing.

Islamist militants al Shabaab claimed responsibility for this weekend’s attack, which took place ahead of a planned meeting to try to defuse tensions between the federal government and regional states. Government officials had begun to meet at the hotel to discuss strategy.

“So far I am sure 29 people died - the death toll may rise,” Abdullahi Nur, a police officer, told Reuters.

At least 12 of the dead were police officers, Nur said. A woman was beheaded while her “three children were shot dead”, he said.

A Reuters witness saw seven bodies lying inside the hotel. (Click tmsnrt.rs/2gTg1ds for a graphic showing map where explosion took place)

Three militants were captured alive and two others blew themselves up after they were shot, police said. Some militants may have disguised themselves and escaped with the residents who were rescued from the hotel, one police officer said.

The attack began around at 5 p.m. on Saturday when a car bomb rammed the gates of Nasahablod Two hotel, which is close to the presidential palace, and destroyed the hotel’s defenses. Then gunmen stormed the building.

The explosion destroyed the front of the three-storey hotel and damaged the hotel next door. Many Somali officials live in fortified hotels for the security they offer.

The attack presents a further challenge to the new government of President Mohamed Abdullahi Mohamed, whose defense minister and chief of army staff resigned this month. They did not give their reasons for leaving.

On Sunday, the government sacked the country’s police commander, Abdihakin Dahir Saiid, and the director general of the National Intelligence Security Agency, Abdullahi Mohamed Ali, the prime minister’s office announced.

Abdikadir Abdirahman, director of Amin ambulances, complained the emergency service had been denied access to the blast sight.

“After the hotel operation was over, we wanted to transport the casualties ... all entrances of the scene were blocked by security forces.

Slideshow ( 6 images )

Al Shabaab said 40 people had been killed, including three of its fighters who stormed the hotel. The government and al Shabaab typically give different figures for victims in such attacks.

The twin bombings in Mogadishu on Oct. 14 killed at least 358 people and ignited nationwide outrage. Al Shabaab has not claimed responsibility for that attack, but the method - a large truck bomb - is one it has often used.

The militant group wants to overthrow the weak, U.N.-backed government and impose a strict form of Islamic law.