Al-Shabab fighters attacked a military base near Somalia's southern port city of Kismayu early on Sunday, a Somali army officer said, adding that he did not immediately have details of any casualties.

The armed group claimed responsibility for the attack and said 26 Somali soldiers had been killed in the incident, but that could not be confirmed by other sources.

"We understand al-Shabab attacked the base and fierce fighting and a blast occurred, but still we have no details," Mohamed Isa, a military officer, told Reuters news agency from Kismayu.

The attack was on a base in the village of Bula Gudud, near Kismayu.

State radio also reported the base had been attacked but said casualties were not yet known.

The base is jointly operated by the Somali national army and forces from the semi-autonomous Jubbaland region of southern Somalia, it reported.

Residents in Bula Gudud said a blast was heard and an exchange of gunfire broke out shortly after the first Muslim prayer of the day.

Abdiasis Abu Musab, al-Shabab's military spokesman, told Reuters: "This morning, we stormed the Jubbaland base near Bula Gudud. We killed 26 soldiers and burnt two cars."

The group left the base after taking weapons, ammunition and several vehicles, he added.

Al-Shabab is linked to al-Qaeda and wants to impose strict Islamic law in Somalia.

The group routinely exaggerates casualty figures.