Somali forces have ended a deadly siege at a hotel in the capital Mogadishu which saw more than 20 people killed and dozens of hostages freed, authorities say.
Elite armed forces in the Horn of Africa nation battled al Qaeda-linked militants for 30 hours, after the jihadists blasted and shot their way into the Hayat Hotel on Friday evening.
The siege ended around midnight on Saturday, police commissioner Abdi Hassan Hijar told reporters.
“During the attack, the security forces rescued many civilians trapped in the hotel, including women and children," he said.
Minister for Health Ali Haji told national broadcaster SNTV that 21 people had been killed and 117 injured in the siege.
Gunfire could still be heard on Saturday evening as security forces tried to contain the last gunmen thought to have been holed up on the hotel's top floor.
The Islamic extremist group al Shabaab, which has ties with al Qaeda, claimed responsibility for the attack, the latest of its frequent attempts to strike places visited by government officials.
The attack on the hotel is the first major terror incident in Mogadishu since Somalia's new leader, Hassan Sheikh Mohamud, took over in May.
US condemns attack, pledges support
In a Twitter post, the US Embassy in Somalia said it "strongly condemns" the attack on the Hayat.
"We extend condolences to the families of loved ones killed, wish a full recovery to the injured, and pledge continued support for Somalia to hold murderers accountable and build when others destroy," it said.
There was no immediate word on the identities of the victims, but many are believed to be civilians.
"We were having tea near the hotel lobby when we heard the first blast, followed by gunfire," witness Abdullahi Hussein said by phone.
"I immediately rushed toward hotel rooms on the ground floor and I locked the door.
"The militants went straight upstairs and started shooting. I was inside the room until the security forces arrived and rescued me."
He said on his way to safety he saw "several bodies lying on the ground outside hotel reception."
Residents were milling around the bombed-out hotel on Sunday as authorities began the clean-up operation at the building, which suffered extensive damage.
Al Qaeda-linked terror group behind attack
Al Shabaab remains the most lethal Islamic extremist group in Africa.
The group has seized even more territory in recent years, taking advantage of rifts among Somali security personnel as well as disagreements between the government in Mogadishu and regional states.
It remains the biggest threat to political stability in the volatile Horn of Africa nation.
Forced to retreat from Mogadishu in 2011, al Shabaab is slowly making a comeback from the rural areas to which it retreated, defying the presence of African Union peacekeepers as well as US drone strikes targeting its fighters.
The militants in early May attacked a military base for African Union peacekeepers outside Mogadishu, killing many Burundian troops.
The attack came just days before the presidential vote that returned Mr Mohamud to power five years after he had been voted out.