NAIROBI, Kenya — More than a dozen people, including at least four Ethiopian soldiers, were killed Saturday in a suicide attack on a cafe in western Somalia, near the border with Ethiopia. The Shabab, the militant Somali Islamist group, claimed responsibility.

The attacker, strapped with explosives, blew himself up around 11 a.m. in Beledweyne, a city about 200 miles northwest of the capital, Mogadishu, officials said. Col. Isack Ali Abdulle, a police commander in Beledweyne, told local reporters that the attack had killed 15 people.

A spokesman for the Shabab, Abdiaziz Abu Musab, said the suicide bomber had been targeting soldiers from Ethiopia and Djibouti who frequented the cafe. Mr. Musab gave a higher death toll, saying 25 people had been killed.

A spokesman for the African Union, which has a peacekeeping force in Somalia to help local forces fight the Shabab, said soldiers from Djibouti and Ethiopia did patrol the area of Beledweyne, though Ethiopian troops are not part of the peacekeeping mission. Four or five Ethiopian soldiers were among the dead, a Somali official said.