At least 19 people have been killed in a suicide attack on an African Union base in the Somali town of Beledweyne near Ethiopia's border, officials say.
A car rammed into the gates, exploded and gunmen then stormed the building.
The BBC's Mohammed Moalimu in Somalia says it is a base for Djiboutian troops and Somali policemen.
An al-Shabab spokesman, Abdiasis Abu Musab, told the Reuters news agency that the al-Qaeda-linked group had carried out the attack.
Last month, the Islamist group said it was behind a suicide attack at a popular cafe in Beledweyne which killed 16 people.
Beledweyne is a strategic town, 30km (20 miles) from the Ethiopian border on the main road to the capital, Mogadishu, and also on the major artery linking the north and south of the country.
Al-Shabab militants have been driven out of Somalia's major towns by a UN-mandated African Union force (Amisom) of some 18,000 soldiers, but still control large parts of southern Somalia.
Eyewitnesses told the BBC that a suicide bomber blew up a vehicle he was driving at the gates of the police station in Beledweyne.
Gunmen then went into the station and began shooting at the people inside, the witnesses said.
One eyewitness told the BBC Somali Service most of the dead were Somali policemen.
Health officials in the town say at least 19 people have died.
"The explosion was enormous and there are casualties... but the situation is now under control," Col Abdulkadir Ali, a senior police commander in the town, told the AFP news agency.
Local al-Shabab commander Mohamed Abu Suleiman told AFP special commandos had carried out the attack.
Somali President Hassan Sheikh Mohamud said such attacks were self-defeating and showed no regard for life.
"My first priority is to send my personal condolences to the victims and families affected by this stupid attack," he said in a statement.
"Amisom and Somali security forces alike have paid a heavy price for their brave role in stabilising Somalia.
"I say this was a stupid attack because our enemies need to understand that these attacks do nothing to advance their cause, however misguided."
In September, al-Shabab said it carried out the attack on the Westgate shopping centre in the Kenyan capital, Nairobi, in which 67 people died during a four-day siege.
It said it staged the attack in response to Kenya's army carrying out operations on Somali territory.