At least seven soldiers were killed when fighters of the Somali Islamist group al Shabaab stormed a jail in the semi-autonomous state of Puntland early on Friday, police and the group said.
Al Shabaab said it had freed at least 400 prisoners, many of them its members, in its assault on the main prison in Bosaso, Puntland's largest city, in the early hours of Friday. The authorities did not confirm that figure.
"Last night many well-armed men attacked us from various directions. We fought back but finally they entered the central jail by force using explosions. They freed the prisoners and took most with them," Mohamed Abdi, a prison guard, told Reuters.
"There was a hellish battle... As I fought inside, we lost five soldiers."
He said two other soldiers who had been sent to reinforce the regular prison guards were killed in their car which was set on fire.
Al Shabaab confirmed that its fighters had carried out the attack and said they had freed at least 400 prisoners. The group often exaggerates its successes in such assaults.
"The prisoners included men and women who were al Shabaab members and were in jail for over 10 years," Abdiasis Abu Musab, al Shabaab's military operations spokesman, told Reuters.
Al Shabaab frequently carries out such attacks in Somalia and elsewhere as part of its campaign to oust the central government in Mogadishu and establish its own rule based on its strict interpretation of Islamic sharia law.
Bosaso police commander, Col. Hussein Ali, said an operation was underway to recapture prisoners who had escaped or had been taken away by the fighters.