An al-Shabab suicide car bomber has struck the entrance of Mogadishu's largest port and an adjacent police complex, killing at least 29 people and wounding nearly 48 others, according to police sources.
Initial reports had put the toll at 12 dead and 14 injured, but more bodies were discovered in the rubble of the collapsed buildings, according to officials.
There were also more deaths as people succumbed to their injuries in hospital.
IN PICTURES: Exclusive - Al-Shabab moves in on central Somalia
Most of the victims were labourers and port workers, General Abdullahi Hassan Barise, a senior police officer, told DPA news agency. Among the dead were at least five police officers and two young boys.
Civilians made up most of the wounded.
The attack took place near the gate of Mogadishu's main port and is the latest in a series of attacks on the capital.
The bomber drove a minibus packed with explosives into the police station and a security checkpoint, witnesses said.
Al-Shabab took responsibility for the attack via a statement on its radio station, Radio Andalus.
The armed group said the suicide bomber was targeting the police station, where a number of officers also lived.
The station was heavily damaged and a busy tax facility was also affected by the blast.
The destruction also spread to nearby homes and vehicles.
INTERACTIVE: Al-Shabab attacks in Somalia (2006-2016)
Thick plumes of black smoke could be seen above the blast site throughout the city.
Gunfire could be heard from the police complex shortly after the explosion. Police said the situation was under control and security forces were using warning shots to disperse people.
"The area has been surrounded by Somali security forces and African Union troops," said security forces spokesman Abdikamil Shukri Ma'alin.
Somalia is preparing to hold presidential elections on December 28.
Source: News agencies