Bajaajlayaasha: Canshuur bixiyaal dhiigoodda la baneystay
All the attackers, three government soldiers and at least one civilian were killed, said Mohamed Yusuf, a spokesman for Somalia's National Security Ministry.
Mogadishu's Godka Jilacow prison, the scene of the Sunday morning attack, is a key interrogation center for Somalia's intelligence agency and many suspected militants are believed to be held in underground cells there.
Somali police Capt. Mohamed Hussein said the attackers were "trying to free terrorists held in the prison."
The Somali rebel group al-Shabab, which is linked to al-Qaida, claimed responsibility for the attack that shattered a period of calm in Mogadishu, which is stabilizing after nearly 20 years of chaotic violence.
The attack started when a suicide car bomber detonated an explosives-laden vehicle at the gate of the prison, followed by gunmen who fought their way into the prison. Guards fought the attackers who threw grenades to penetrate the prison's defenses, police said.
Soldiers in pick-up trucks rushed to the prison and troops took positions around the facility, residents said.
Mohamed Hassan, a resident who lives near the prison in the neighborhood of the presidential palace, said he heard gunfire and explosions as soldiers and militants fought for control of the notorious jail.
Another resident, Mohamed Abdullahi, described a terrifying scene with bullets "flying around." Ambulance sirens echoed across the capital as those wounded in the attack were taken into the hospital wards for treatment.
The attack on the Mogadishu prison came as government soldiers, backed by African Union troops, launched an assault on militant bases in the southern parts of this Horn of Africa nation.
On Saturday the southern town of Bulomarer, which is about 110 kilometers (70 miles) south of Mogadishu, was seized from militants after hours of fighting.
Al-Shabab used Bulomarer to stage deadly attacks across Somalia, including in Mogadishu, say military officials. The military offensive dubbed "Indian Ocean" is planned to oust al-Shabab from one of its last major centers, said the officials. The loss of Bulomarer would leave al-Shabab's current key base of the coastal town of Barawe vulnerable to attacks.
Bajaajlayaasha waxaa la dilaa iyaga oo bixinaya canshuurtii dowladda, waana cadaalad daridda ka jirta Muqdisho sida uu Farmaajo xilka ula wareegay oo ku kalliftay dhalinyarro badan in ay gabi ahaamba dalka isaga tagaan.