Somalia's army soldiers and peacekeepers from the African Union Mission in Somalia (AMISOM) enter the town of Barawe during the second phase of Operation Indian Ocean. [Reuters]

Somalia's al Shabaab group attacked an African Union mission troop camp in the Shabelle region in the centre of the country, a local elder and the group said on Tuesday, and another resident said three civilians had died in the crossfire.

The resident, who lives in a village near the scene, later said he saw two helicopters flying by and gunfire coming from them.

"We were awoken by huge blasts early in the morning. The blasts were at the African Union mission base. Heavy exchange of gunfire followed," local elder Mohamed Nur told Reuters by phone from El Baraf, about 130 km (80 miles) to the north of the capital Mogadishu.

Al Shabaab, which has been fighting for years to topple the central government and establish its own rule based on its strict interpretation of Islam's sharia law, claimed responsibility for the attack.

"The Mujahideen launched a pre-dawn raid on an ATMIS (African Union Mission) military base in El Baraf, middle Shabelle region," al Shabaab said in a statement.

"After a fierce firefight, the Mujahideen managed to overrun the base and are now in complete control of the entire military base."

Farah Hussein, a shopkeeper, told Reuters from El Baraf that after the initial attack, helicopters were seen flying above the scene.

"We heard some gunshots and sounds of weapons being fired from the helicopters," he said by phone.

"The ATMIS forces are also in the jungles pursuing the al Shabaab fighters. So far we know three civilians died and five others were injured in the fighting."

Officials in Shabelle and the African Union mission were not immediately available to comment on the attack.

Al Shabaab frequently carries out bombings and gun attacks in Mogadishu and elsewhere as part of its war against the Horn of Africa country's central government.

It also attacks soldiers working for the African Union peacekeeping mission.