Nine people were killed including government soldiers and militants who attacked the Baidoa presidential palace.
Two explosions rocked Sharif Hassan Sheikh Adan administration headquarters before heavy gun fight between soldiers and attackers believed to belonging to Al Shabaab.
Three government soldiers, one Ethiopian soldier and two Al Shabaab attackers are reported to have been killed in the siege which is now over.
President Sharif Hassan Sheikh Adan was inside the residence during the attack.
UN envoy to Somalia Nicholas Kay has condemned the attack saying he spoke to Sharif Hassan and he is safe and sound.