At least 19 people have been killed when gunmen blasted their way into a police station run by African Union forces north of Somalia's capital on Tuesday and opened fire on officers and civilians inside.
A spokesperson for Al-Shabab claimed responsibility for Tuesday's attack in the city of Beledweyne.
"Target of the attack is the apostate soldiers and Djibouti soldiers who were at the base," a spokesperson told Al Jazeera, referring to African Union forces who are part of the AMISOM force helping the Somali government to secure the country.
"We have killed many of them. Our fighters are also now in control of Madina hotel which is next to the base."
Col. Osman Dubbad, the commander of Djiboutian troops in the city of Beledweyne, near the border with Ethiopia, however said pro-government forces killed 10 attackers, including two suicide bombers.
Col. Ismael Ali, a police officer in Beledweyne, said five soldiers and four civilians were killed by a car bomb blast.
Al-Shabab told Reuters many of its men had since managed to get away unharmed.
Officials said that gunmen forced their way inside the police station, where an hour-long gun battle ensued.
African peacekeepers and Somali troops surrounded the compound and opened fire. Witnesses said the shooting inside then stopped.
Al-Shabab has been driven out of many of its strongholds, including Mogadishu and Baladweyne, over the past two years. But it has kept up car bombings and guerrilla attacks.
The attackers blew their way through the compound's gates with a car bomb, said witnesses.
"First, a speeding car went past us and soon we heard a big explosion followed by gunfire. The car rammed into the gate of the police station. We can see a huge (plume of) smoke and hear exchange of gunfire," said shopkeeper Nur Osman at the scene.
Somali legislator Dahir Amin Jesow said some of the attackers were among the confirmed dead.
"The death toll can rise because the militants unexpectedly entered and shot anyone they saw. We do not yet know the exact number of attackers," Jesow added.
Somali President Hassan Sheikh Mohamud condemned the attack.
"I say this was a stupid attack because our enemies need to understand that these attacks do nothing to advance their cause, however misguided," the president said.
Al Jazeera and wire services