Dozens of soldiers have been killed after Al-Shabaab overran an African Union base in Somalia, according to witnesses.

People in the village of Lego, about 62 miles north-west of the capital Mogadishu, described intense fighting on Friday which left corpses strewn on the ground. Witnesses said there were as many as 50 bodies, some of which had been decapitated, but this could not be confirmed.

Alinur Mohamed, a local elder, said: “The fighting was the heaviest ever around this area. Al-Shabaab took full control of the base and killed many soldiers.”

The military outpost had been manned by about 100 Burundian soldiers, part of the 22,000-strong African Union Mission in Somalia (Amisom).

Residents said the dawn raid began when a suicide bomber drove a car loaded with explosives into the entrance of the base, before dozens of militants armed with machine guns and rocket-propelled grenades unleashed their assault.

Another elder, Ahmed Bulle, said Al-Shabaab fighters were later seen looting the base and loading supplies on to trucks.

He said: “Al-Shabaab took control of the area completely – the death toll could be more than 50. There are many dead bodies, most of them in military uniforms.”

Earlier on Friday, Amisom confirmed the attack but gave no further details as to possible casualties.

An Al-Shabaab spokesman claimed the militants had taken control of the base, killing “dozens”, raised their flag and seized weapons.

Mohamed Abu-Yahya, an Al-Shabaab commander, said: “The Black Islamic flag is flying over the main base of Amisom in Lego this morning and the dead bodies of the enemy are scattered around the area, the mujahideen fighters have taken all their military supplies.”

Al-Shabaab, an al-Qaida affiliate, is fighting to overthrow Somalia’s western-backed government, which is propped up and protected by Amisom.

Under military pressure at home, it is increasingly turning its attention to Kenya, where it has recently launched a string of deadly assaults.

The Islamic militants commonly step up their attacks during Ramadan, the month of fasting for Muslims.