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 huge explosion and gunfire were heard coming from Godka Jilicow - a detention centre that holds al-Shabab militants - in Mogadishu on Saturday evening.

In a statement, al-Shabab said it released all the Muslim prisoners from the facility and inflicted heavy casualties on those guarding the centre.

The militants disguised themselves as soldiers in order to enter the prison, government-run news agency Sonna Live reported on Sunday.

The government did not indicate how many of its security forces were killed during the incident, but offered condolences to the families of the fallen heroes.

Al-Shabab did not provide its own death toll for militants involved in the attack.

The fighting began at around 16:40 local time (13:40 GMT), adding to the ongoing volatility in the region.

Godka Jilicow is located near the Somali presidential palace, in the heart of Mogadishu. It is manned by Somalia's National Intelligence and Security Agency (Nisa) and holds al-Shabab militants and other high-profile detainees.

This attack poses a significant challenge to Nisa and raises concerns over how militants gained access to one of Mogadishu's most heavily defended areas.

Al-Shabab, affiliated with al-Qaeda, has been conducting a violent insurgency against the Somali government for nearly two decades.

Ironically, just hours before the attack, the government had reopened several key roads in Mogadishu that had been closed for security reasons, citing improvements in the city’s safety.