Police said guards at Hotel Sahafi and CID officers opened fire after the explosions.
According to witnesses, a third blast rocked the busy street about 20 minutes later.
"So far we have confirmed 17 civilians dead. They were travelling in public vehicles at the scene when the blasts and gunfire occurred," said Ali Nur, a police officer in the city. He added that the number of deaths “is sure to rise.”
Earlier, Mohammed Hussein, another police officer, said the target of the attacks was Hotel Sahafi, which is just opposite the CID office.
No group has yet claimed responsibility for the attacks which bore the hallmark of al-Qaeda-linked al-Shabab militant group, Presstv reported.
Despite being ousted from large parts of the south and central Somalia, al-Shabab continues deadly attacks across the country, which has been ravaged by decades of war and poverty.
The militant group aims to oust the Western-backed government in Mogadishu and drive out African Union peacekeeping troops. It has been carrying out militancy since 2006.