Militant group Al Shabab exploded a suicide car bomb and killed at least nine people, including Somalia's former foreign minister, near the presidential palace in the capital on Wednesday, police said.
Former foreign minister Hussein Elabe Fahiye, who was an advisor to the current president, was among those killed in the blast.
Another 13 people were wounded and most of the casualties were soldiers.
Al Shabab said in a statement it had targeted a convoy escorting officials and lawmakers heading to the presidential palace.
"A car bomb blast struck at a checkpoint near Daljirka; there are some casualties including members of the security forces," said security official Abdukadir Ahmed after the attack in the south of the city.
"I saw the bodies of three people among them a military woman," said witness Mohamed Saney.
"Several vehicles were destroyed in the blast and ambulances rushed to the scene to collect wounded people."
"In the past, I was wounded in this area, and again today my daughter has been killed in this attack which also destroyed my home. This is terrible," witness Madey Ahmed said.
Amid the crumpled vehicles and tangled metal roofing, a small corps of yellow-vested workers carried bodies and began sweeping the dusty street.
Al Shabab militants have been fighting for more than a decade to topple the government. They fled positions they once held in Mogadishu in 2011, and have since lost many of their strongholds.
But they retain control of large rural swathes of the country and continue to wage a guerrilla war against the authorities.