MOGADISHU (Reuters) - Somali government troops shot dead three Islamist militants holed up in a building in central Mogadishu on Friday, police said, ending a day-long bomb and gun attack that killed at least 29 civilians.

Islamist al Shabaab fighters launched the assault with a suicide car bomb outside the Maka Al-Mukarama hotel on Thursday evening, destroying other structures, igniting a huge fire and leaving people wounded in the rubble.

(Graphic: Map showing location of attack in Somali capital - tmsnrt.rs/2UazBR6)

The militants - who are fighting to overthrow the Western-backed government - fled to a neighboring building and opened fire on special forces and other soldiers sent to flush through out throughout Friday.

“The operation is over and the building is now controlled by the security forces. The three militants were shot dead, their bodies are inside the building,” police officer Captain Osman Mohamed told Reuters late on Friday afternoon.

It was the longest that the militants had held a position in Mogadishu since Somali troops backed by African Union peacekeepers forced them out of the city in 2011.

“Our special operation in Mogadishu successfully concluded after almost 24 hours. It targeted a hotel frequented by the members of the apostate government. Dozens of them eliminated, more injured,” Abdiasis Abu Musab, al Shabaab’s military operation spokesman, told Reuters on Friday.

He gave a different figure to police, saying: “Four of our Mujahideen were martyred, others managed to come back after the operation.”

The attack on the hotel came the same day that U.S. forces said they carried out an air strike that killed 26 militants in the Hiran area, north of the capital - part of an escalation of Washington’s fight against the al Qaeda-linked group.

Somalia’s government had earlier said the gunmen took hostages, but there were no immediate details on their fate.

“There are no civilian casualties in this building. But there may be dead civilians under the collapsed Hilco UK restaurant which is also nearby,” Captain Mohamed said.

DEATH TOLL MAY RISE

Health officials said it was too early to estimate the full impact of the attack. “The death toll may rise and rise,” said Abdikadir Admen, the director of the privately-run Amain ambulance service.

Slideshow ( 11 images )

Al Shabaab said it had repulsed three government raids on the building. [nL5N20N90U]

Soldiers manned roadblocks around the site during the fighting and fired into the air to keep back relatives who shouted out the names of missing loved ones.

“I have been running to and fro from the blast scene to hospitals since yesterday (Thursday) evening in search of my husband and brother ... I have just seen them in hospital. They are in a critical condition,” mother-of-three Hallam Omar told Reuters.

Slideshow ( 11 images )

Somalia has been convulsed by lawlessness and violence since 1991, and a further layer of chaos was added in 2015 with the formation in the north of a splinter group of former al Shabaab insurgents who pledged allegiance to Islamic State.

At least 25 people have been killed this week in clashes between the two militant groups, a military official from the semi-autonomous region of Puntland told Reuters.

Al Shabaab has also carried out attacks in neighboring countries contributing to the African Union gatekeeper force inside Somalia, including one on a hotel and office complex in Kenya in January that killed 21 people.

Under U.S. President Donald Trump, Washington has stepped up attacks against the group, and U.S. Africa Command has announced six air strikes in recent days that it said killed a total of 83 militants since Feb. 23.