Seven al-Shabab militants who attacked a high-security prison in Somalia's capital have all been killed, according to the country's government.

A significant explosion and gunfire were reported from Godka Jilicow— a detention center that holds al-Shabab militants— in Mogadishu Saturday evening.

In a statement, al-Shabab claimed to have freed all the Muslim prisoners from the facility and inflicted heavy casualties on those guarding the center.

The militants managed to enter the prison dressed as soldiers, as reported by the government-run agency Sonna Live on Sunday.

The government did not specify how many of its security forces were killed during the clash but expressed condolences to the families of the fallen personnel.

Al-Shabab, on the other hand, did not disclose a death toll for its militants involved in the attack.

Fighting erupted around 4:40 PM local time (1:40 PM GMT) at Godka Jilicow, situated near Somalia's presidential palace and overseen by the National Intelligence and Security Agency (NISA), housing al-Shabab militants and other high-profile detainees.

This incident represents a significant setback for NISA, raising questions about the militants' ability to penetrate one of the capital's most fortified areas.

Al-Shabab, an affiliate of al-Qaeda, has been waging a violent insurgency against the Somali government for nearly two decades.

Interestingly, just hours before the assault, the Somali government reopened key roads in Mogadishu that had been closed due to security concerns, citing improvements in the city's safety.