The Somalia-based group has vowed to step up attacks in Mogadishu and elsewhere after the federal government recently announced a new offensive against the group. Targets have included high-profile spots like military facilities, hotels and areas close to the presidential palace.
The car with explosives had been parked outside a restaurant near the city's port, Capt. Mohamed Hussein told The Associated Press. Among the dead were a mother and child who were at the restaurant, he said.
"We would ask Allah to give his mercy on their souls," said Abdifitah Halane, spokesman for Mogadishu's mayor.
Al-Shabab last year became the deadliest Islamic extremist group in Africa, with more than 4,200 people killed in 2016, according to the Washington-based Africa Center for Strategic Studies.
Somalia's military is under growing pressure to assume more responsibility for the long-chaotic country's security as a 22,000-string multinational African Union force plans to start withdrawing next year.
The prospect of a security vacuum has concerned the international community. Somalia's president has urged that the U.N. arms embargo on his country be lifted soon, saying the military needs more than AK-47s to combat al-Shabab and the small but growing presence of Islamic State-linked fighters in the north.
President Mohamed Abdullahi Mohamed, a Somali-American who was elected in February, has repeatedly said al-Shabab can be defeated within two years, but he warns that could take much longer without a better-equipped national military.
On Tuesday, the national police chief in neighboring Kenya said al-Shabab attacks had increased in that country as the extremist group faces growing pressure from the AU force in Somalia.
Associated Press videographer Mohamed Sheikh Nor contributed.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.