Somali security forces have retaken control of a popular beachside restaurant in Mogadishu after a deadly attack there by Islamist militants.
The gunmen had approached the restaurant from Lido beach on Thursday evening, firing on diners.
Twenty people were killed. Militants also detonated two car bombs nearby.
Al-Shabab said it was behind the attack. The group has carried out frequent assaults on the Somali capital.
Troops then besieged the attackers at the restaurant for eight hours. It was not immediately clear how many of the militants were killed or captured.
The Somali authorities said the leader of the attack had been arrested.
Prime Minister Omar Abdirashid Ali Sharmarke condemned the killings as "barbaric".
There are varying reports about how the attack started but it appears that as the first car bomb went off, at around 19:30 local time (16:30 GMT) on Thursday, the gunmen stormed the area.
"They randomly fired at the people sitting near the beach before entering the restaurant,'' witness Ahmed Nur told Associated Press.
Twenty people were injured in addition to those killed, police said.
At the scene: Ali-Bashe Abdullahi Abdi, director of Mustakbal Radio, Mogadishu
After the evening prayer, I went to Lido beach, in particular Beach View restaurant. When I was there about 30 minutes, and I was spending time with my friends including journalists, we saw bullets raining on us.
A good number of people were seated around me, there was a wedding ceremony at the hall of the restaurant. We started running towards the door, but before I reached it we heard a loud explosion.
I saw some people jumping from the second floor. Bullets were flying all over the place, and there was another explosion. Then everyone got confused. I personally saw three wounded people. I did not see those who have been harmed by the explosions. I think the car was parked near the main door of the restaurant.
Lido beach, on the northern edge of Mogadishu, attracts thousands of mostly young Somalis who come to relax and enjoy the beach and the surf.
Several restaurants have opened up along the beach front in recent years, and people would have been sitting out in front of them when the attacks began.
Al-Shabab, which has links to al-Qaeda, was ousted from Mogadishu in August 2011, but still has a presence in large areas of southern Somalia.
The group stormed an African Union military base last week in southern Somalia, killing dozens of Kenyan troops.