Fighters from Somalia's armed group al-Shabab have attacked an army base southwest of the capital, Mogadishu, killing at least 10 soldiers, the group and a military officer told the Reuters news agency.

The attackers exploded a car packed with explosives before storming the Lanta Buro base in Lower Shabelle region, some 50km outside Mogadishu, on Monday morning.

"Heavy exchange of gunfire continued for hours," Major Ahmed Farah told Reuters from the nearby town of Afgooye. At least 12 al-Shabab fighters were killed, he added.

Residents said they heard heavy gunfire and an explosion before the fighters stormed the base.

Al Jazeera's Charles Stratford, reporting from Kenya's capital, Nairobi, said that al-Shabab was claiming that they had killed around 30 soldiers and that they took away with them "one armoured ambulance, four other armoured vehicles and two military trucks".

"According to local reports, the Somali army say only five soldiers were killed, but they do admit that at least two military trucks were taken away," Stratford added.

READ MORE: Al-Shabab raid on Mogadishu hotel ends with 16 deaths

"It is important to remember that they [al-Shabab] lost control over the port of Kismayo in 2012, a port that they heavily relied on for getting weapons through that port. So now they rely on sumiliar kind of attacks for their weapons supply," Stratford said.

Al-Shabab often launches attacks on Somali security forces, officials and army bases in an effort to topple the government and impose its own brand of government on Somalia.

On Sunday, more than 100 members of al-Shabab raided a police station in northeast Kenya overnight, wounding one officer and making off with arms and ammunition, according to police.