Al-Shabaab suicide bombers and gunmen targeted the Criminal Investigation Department (CID) headquarters in Mogadishu on Sunday, leaving 13 dead, a Somali minister confirmed.
Security Minister Abdirisak Omar Mohamed told reporters that seven militants from the Islamist extremist group were among the dead.
Two of them were suicide car bombers and five gunmen tried to storm the building, he said.
Five policemen were among the 20 people wounded.
The CID is located near a busy junction in the heart of the Somali capital.
Security forces prevented the attackers from reaching inside the compound as a fierce gun battle ensued, ending in all the militants being killed, the minister said.
Al-Shabaab claimed responsibility for the attacks on the pro-insurgent Radio Andalus.
Simultaneous powerful explosions were heard followed by gunfire.
"I saw a vehicle [driving] into the gates of the Criminal Investigation Department at a high speed and then a huge blast went off," said witness Mohamed Abdi.
Police use the targeted facility to interrogate and sometimes hold suspected militants and other criminals.
The group, which is seeking an Islamist state in Somalia and is affiliated with the international al-Qaeda terrorist network, has attacked government facilities and hotels in Mogadishu on a regular basis.