A Briton was among several foreigners killed in a terrorist attack on a hotel in Somalia, officials said.

Those killed in the attack in the southern port city of Kismayo also included three Kenyans, three Tanzanians, two Americans, one Canadian and one Briton, said Ahmed Madobe, the president of Jubbaland regional state.

Fifty-six people, including two Chinese, were injured in the attack before Somali forces ended the all-night siege.

At least four al-Shabab extremists attacked the Asasey Hotel on Friday evening, beginning with a suicide car bomb at the entrance gate and followed by an assault by gunmen who stormed the hotel, which is popular with politicians.

At least 40 people were injured in the attack which lasted more than 14 hours before troops shot dead all attackers inside the hotel compound, a police spokesman said.

Somalia’s Islamic extremist rebels, al-Shabab, claimed responsibility for the attack. The group, which is allied to al Qaida, often uses car bombs to infiltrate heavily fortified targets like the hotel in Kismayo, which has been relatively quiet in recent years.

Asasey Hotel in Kismayo after the attack
Asasey Hotel in Kismayo after the attack (Stringer/AP)

Canadian journalist Hodan Nalayeh and her husband, Farid Jama Suleiman, died in the attack.

“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. What a loss to us. Her beautiful spirit shined through her work and the way she treated people,” Omar Suleiman, a Texas-based imam who knew the victim, wrote on social media.

Ms Nalayeh was born in Somalia in 1976 but spent most of her life in Canada, first in Alberta and then in Toronto.

She founded Integration TV, an international web-based video production company aimed at Somali viewers around the world. She was the first Somali woman media owner in the world.