Witnesses tell how they heard explosions and gunfire and saw smoke pouring out of the prison, which is located near the presidential palace. The building also houses the headquarters of the regional security service.
The jihadist group al-Shabaab says it is behind the attack and that they have released prisoners.
State-owned Somali media report that soldiers at the prison stopped the attack and killed several of the attackers.
There is no information on the number of dead or injured in the attack.