“A suicide bomber drove a car loaded with explosives into the entrance of Wardhigley District offices,” said security official, Mohamed Samow.
“We understand that at least four people were killed and several injured in the explosion,” he added.
Witnesses at the scene reported a similar toll.
“It was a very large explosion that destroyed several buildings and vehicles in the area,” said Said Farey, who saw the attack.Ads By Google“The bodies of several people killed and injured were taken away in an ambulance,” he added.
The district mayor, who was in the building at the time, escaped unharmed, administrative and security sources said.
Security has been beefed up at checkpoints to prevent further attacks during the holy fasting month of Ramadan.
Although the attack was not immediately claimed, the Islamist militant group Al-Shabaab has a history of targeting government buildings in the Somali capital.
The Al-Qaeda-linked militants were chased out of Mogadishu in 2011 but still control large swathes of rural Somalia, from where they orchestrate attacks.
Shabaab militants claimed responsibility for the murder of a Turkish engineer on Sunday, who died in Mogadishu after a bomb was placed under his pick-up truck.
For over a decade Shabaab militants have fought the government in Mogadishu, which is backed by the international community and a 20,000-strong African Union force.
—Additional reporting by Abdulkadir Khalif.