Eight people were killed in Somalia's capital, Mogadishu, on Saturday after gunfire broke out between security forces and some prisoners who had acquired weapons and were trying to escape, state media and the prisons service said.
The firefight broke out in the capital's main prison, located in the city's south near the port.
During the operation five prisoners and three soldiers were killed while 21 people, majority of them inmates, were injured, Abdiqani Mohamed Qalaf, spokesperson for the prison service said on Facebook.
He blamed "a violent group" among the prisoners for the attack.
No prisoners had escaped and an investigation into how the attack occurred will be conducted, he added.
Militant group Al-Shabaab has carried out numerous bombings and other attacks in Mogadishu and other parts of the troubled country, although few have been recorded in recent months.
"There was an explosion inside the prison and a heavy exchange of gunfire followed," said witness Abdirahman Ali.
Grenade blasts
"I was very close to the prison when the incident occurred and I saw police enforcements entering the prison a few minutes after the gunfire broke out," he said.
Another witness, Shuceyb Ahmed, also reported hearing grenade blasts and gunfire.
"I called my brother who is a member of the prison guards, and he told me that several Al-Shabaab inmates secretly obtained weapons and grenades and tried to escape."
The Somali National News Agency (SONNA) published pictures of the dead bodies of the five alleged Al-Shabaab gunmen.
The Somali Custodial Corps is a branch of the security forces responsible for running prisons in the country.
Al-Shabaab has been fighting to oust the fragile central government in Mogadishu for more than 17 years.
Government setbacks
The government has joined hands with local clan militias to fight the militants in a campaign supported by an African Union force and US air strikes.
But the offensive has suffered setbacks, with Al-Shabaab earlier this year claiming it had taken multiple locations in the centre of the country.
➤Click here to follow our WhatsApp channel for more stories.