A suicide bomber detonated explosives inside a small restaurant in a city north of the capital on Saturday, killing at least 12 others, police said.
Mohamed Abdi, a senior Somali police official, said the attack in the city of Beledweyne, about 339 kilometers north of Mogadishu, also wounded at least 10 others.
Many of those killed or wounded are civilians, he said, although it was possible some of the victims were government soldiers.
Beledweyne is under the control of the central government, and African Union peacekeepers from Djibouti are stationed there.
The Somali Islamist militant group, Al Shabab, claimed responsibility for the suicide bombing
"Our main target was Ethiopian and Djibouti troops who invaded our country. They were sitting there," Sheikh Abdiasis Abu Musab, Al Shabab's military operation spokesman said.
He put the death toll from the attack at 25, including troops from Ethiopia, Djibouti and Somalia.
There was no independent word on whether any foreign soldiers were among the casualties in the bombing.
Some witnesses told AFP via telephone: "It was horrible, I counted 12 people killed – among them soldiers – and many others were injured," said Mohamed Islow Ali, a witness.
"There were a lot of people in the restaurant when the bomber blew himself up, many people have died including civilians," Hussein Ali, another witness said.
–Sapa, AFP, Reuters.