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

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 claimed it released all the Muslim prisoners from the facility and inflicted heavy casualties on those guarding it.

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

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

Al-Shabab did not provide an exact death toll for its members.

The fighting began around 16:40 local time (13:40 GMT).

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 is a significant blow to Nisa and raises serious questions about how the militants accessed one of the most heavily guarded regions in the capital.

Al-Shabab, which has ties to al-Qaeda, has been engaged in a severe insurgency against the Somali government for nearly 20 years.

Hours before Saturday's attack, the government had reopened key roads in Mogadishu previously closed for security reasons, citing improvements in the city's safety.