MOGADISHU, Somalia — The Shabab militant group said on Friday that it had overrun an African Union base in a village in southern Somalia and killed dozens of peacekeepers.

Residents described what appeared to be a suicide car bombing, followed by a ferocious firefight that lasted at least five hours. The African Union confirmed an attack on its troops. But central details, including the identity of those killed, were not immediately clear.

Sheikh Abdulaziz Abu Muscab, a spokesman for the Shabab, which is affiliated with Al Qaeda, said the group had killed 63 Kenyan soldiers at the African Union base near the village of El-Adde and had seized ammunition and military vehicles.

A Kenyan military spokesman said that the attack had targeted a Somali military camp, next to the African Union base, and that most of the dead were Somalis, contrary to claims by the Shabab.