Somali forces ended an all-night siege on a hotel in the southern city of Kismayo on Saturday morning after gunmen stormed the building in an attack that killed 26 people.
A presidential candidate for coming regional elections was among the victims of the attack by four militants, Jubaland president Ahmed Madobe said.
At least two journalists and a UN agency staff member were also reported to have been killed.
The dead include three Kenyans, three Tanzanians, two Americans, one Canadian and one Briton, he said. Fifty-six people, including two Chinese, were injured in the hotel attack.
Al Shabab, which is trying to topple Somalia’s central government, claimed responsibility for the assault that began on Friday and lasted more than 14 hours. Fighters attacked the Medina Hotel after detonating a car bomb while local elders and politicians were meeting to discuss the elections.
“Among the dead was also a Jubaland presidential candidate named Shuuriye,” Mr Madobe said.
“Four militants attacked the hotel.
One of them was the suicide car bomber, two were shot dead and one was captured alive by Jubaland security forces.”
The Somalia office of the UN’s International Organisation for Migration also said on Twitter that one of its local staff members, Abdifatah Mohamed, was among those killed.
Sado Somalia, a local non-governmental organisation, said its executive director, Abdullahi Isse Abdulle, had been killed in the attack.
A journalists’ group confirmed on Friday that two journalists were among the victims — Somali-Canadian Hodan Nalayeh and Mohamed Sahal Omar, reporter for SBC TV in Kismayo.
“I’m absolutely devastated by the news of the death of our dear sister Hodan Nalayeh and her husband in a terrorist attack in Somalia today,” Texas imam Omar Suleiman, who knew the victim, wrote on social media. “What a loss to us. Her beautiful spirit shined through her work and the way she treated people.”
Nalayeh was born in Somalia in 1976, but spent most of her life in Canada, first in Alberta and then Toronto.
She founded Integration TV, an international internet-based video production company aimed at Somali viewers around the world.
She was the first Somali woman media owner in the world.
"Through her work as a journalist, Hodan highlighted the community's positive stories and contributions in Canada. She became a voice for many," said Canada's immigration minister Ahmed Hussen.
"We mourn her loss deeply, and all others killed in the Kismayo Attack".
Mohamed Ibrahim Moalimuu, general secretary of the Federation of Somali Journalists, said: “We are saddened and outraged by this loss of life, and condemn in the strongest possible terms this appalling massacre.”
Al Shabab was ejected from Mogadishu in 2011 and has since been driven from most of its other strongholds.
It was pushed out of Kismayo in 2012.
The city’s port had been a major source of revenue for the group from taxes, charcoal exports and levies on arms and other illegal imports. The terrorist group remains a major security threat, with fighters frequently carrying out bombings in Somalia and neighbouring Kenya, whose troops form part of the African Union-mandated peacekeeping force that helps defend the Somali government.