An Al-Shabaab military operation spokesman, Sheikh Abdulaziz Abu Misab, claimed responsibility for the attack, which targeted the gate of Somalia's Criminal Investigative Police Division (CID), Somali police said. The blasts were followed by heavy gunfire, as police shot and killed attackers who tried to enter the building.
Five Al-Shabaab fighters died, said Somali Captain Hassan Abdulkadir. Police shot three, and two others died in the car bombings.
Somali forces cordoned off the area of the blasts, while ambulances transferred wounded to a nearby hospitals for medical treatment, Mohamed said.
Al-Shabaab is working to create a fundamentalist Islamic state and is targeting Somalia. It is al Qaeda's proxy in Somalia, is designated by the U.S. as a foreign terrorist organization and has been blamed for attacks in Somalia and neighboring countries on international peacekeepers, aid workers and journalists.
It favors a strict form of Sharia -- or Islamic law -- and has recruited some Americans, including from the Somali-American community in Minnesota.
An Al-Shabaab spokesman said the group was targeting the peacekeeping mission UNISOM (United Nations Assistance Mission in Somalia).
While many of Al-Shabaab's attacks are inside Somalia, two of its most gruesome attacks took place in Kenya.
Last year, Al-Shabaab gunmen killed at least 147 people at Kenya's Garissa University College.
And a four-day long bloodbath at Nairobi's Westgate mall l
eft people dead in 2013. Five terrorists were also killed.
Al-Shabaab said it had sent the gunmen to the upscale shopping center in retaliation for Kenya's involvement in an African Union battle against them. Kenya has also been a key U.S. partner in battling Islamist terrorism.
Al-Shabaab is different from ISIS because ISIS is mainly focused on solidifying an Islamic state over swathes of Iraq and Syria. It might inspire "lone wolves" in the United States and Europe, "but it is not directing its resources to attack in these areas," said Daniel L. Byman of the Brookings Institution.
"Al Qaeda is weaker and less dynamic than the Islamic State, but the former remains more focused on attacking the United States and its Western allies."