Somalia's security forces have ended a siege at a beachfront restaurant in the capital, with more than 20 people killed in the attack.
Police official Captain Mohamed Hussein, speaking from the scene in Mogadishu, said security forces took control of the restaurant just before dawn on Friday.
It was not clear whether the report of more than 20 killed included the assailants.
Blasts and bursts of gunfire could be heard as Somali special forces went from room to room pursuing the al-Shabab gunmen who were holed up inside the restaurant.
Capt Hussein said the security forces rescued many people who were trapped inside the restaurant's hall, where a party was taking place when the attack started on Thursday.
Witnesses said gunmen shouted "Allahu akbar," the Arabic phrase for "God is great," and entered the restaurant from the direction of the beach as clients, sitting behind razor wire, watched the seashore.
"They randomly fired at people sitting near the beach before entering the restaurant," said witness Ahmed Nur, who was strolling along the shoreline when the attack happened.
Islamic extremist group al-Shabab claimed responsibility for the attack, in a broadcast on its online radio late on Thursday.
Al-Shabab attacked Kenyan peacekeepers in south-western Somalia last week. The al-Qaida-linked group said it had killed about 100 Kenyans and seized weapons and military vehicles.
The Kenyan government has given no death toll, but said there were some fatalities.
Despite being pushed out of Somalia's major cities and towns, al-Shabab continues to launch deadly guerrilla attacks across the Horn of Africa country.
African Union troops, government officials and foreigners are frequently targeted.