Islamist rebels blew up a car bomb and gunmen attacked a national intelligence site in Somalia's capital where suspected militants are held, in an assault on Sunday that left 11 people dead, government officials and the rebel group said, Reuters reported.
Three soldiers and one civilian were killed along with seven militants, including the suicide bomber who detonated the vehicle packed with explosives, Security Ministry spokesman Mohamed Yusuf told reporters at the site.
After the initial blast, gunmen stormed the compound but did not reach the underground cells where suspected militants were being detained, Yusuf said.
One intelligence officer, who identified himself only as Nur, told Reuters the gunmen had entered one building, forcing security personnel to fight room-to-room to clear them out. "All the attackers perished in the end," Nur said.
"It seems their target was to cause a mess here and thus free their militant colleagues held in the underground cells, but that will not happen," Nur said.
Sheikh Abdiasis Abu Musab, al Shabaab's spokesman for military operations, told Reuters the group was behind the attack, the latest in a series of raids in Mogadishu in recent months, including a July assault on the presidential compound.
"For a long time innocent Muslims have suffered in the dungeons of that prison, subjected to torture and humiliation," he said in a statement, adding the raid was "in retaliation and as just punishment for the apostate criminals."
Abu Musab said 15 members of the security forces were killed. Al Shabaab's death toll after attacks is usually much higher than the numbers given by officials.
The presidential compound, which is situated near the national-intelligence site, was also attacked using what has become a familiar tactic: a vehicle tries to blast its way through perimeter security and gunmen charge in afterwards.
The president was not present during the July raid.
Al Shabaab, which wants to impose its own strict version of Islam, controlled Mogadishu and the southern region of Somalia from 2006 to 2011. It was driven out of the capital by peacekeeping forces deployed by the African Union.
African forces launched a new offensive this year to drive the Islamists out of towns and other areas they still control. Several centres have been retaken, but al Shabaab remains in control of some towns and swathes of countryside.