At least 13 people were killed when two vehicles packed with explosives went off as they were driven towards a base for African Union troops in the Somali capital, according to officials and witnesses.

The first blast happened near an entrance to the base, which is beside Mogadishu's main airport, and the second at a nearby checkpoint manned by Somali government forces.

White smoke could be seen billowing over the city after the blast on Tuesday.

"Thirteen people died in the two suicide vehicle explosions," Abdifatah Omar Halane, spokesman for Banadir administration, the local government, told Al Jazeera by phone from the scene of the blasts.

READ MORE: Meeting al-Shabab's elusive leader

"Nine of the dead were security for the UN and three were civilians. Five people were also injured in the explosions," Abdifatah added, not giving details of the 13th death.

A journalist at the scene said ambulances were ferrying the wounded to hospital.

The al-Shabab armed group told Al Jazeera it was responsible for the attack.

"Our Mujahideen targeted Halane which is base to the foreign forces occupying our Muslim country. We have killed dozens of them," Abdulaziz Abu Muscab, a spokesman for the group, said.

AMISOM, the African Union peacekeeping force, said on Twitter that it condemned the attack.

"These senseless attacks ... aim to disrupt the lives of ordinary Somalis," it said.

Farhan Haq, spokesman for the UN secretary general, also denounced the attack.

"It is disturbing, both the attack and the scale of the attack," he told reporters on Tuesday.

"It's clear that the explosives in the trucks were of immense firepower," Haq said, adding that if the guards had not stopped one of the cars from entering the UN premises, there "would have been considerably more damage and loss of life".

It is not the first time that the armed group has attacked the AU force's heavily fortified headquarters in the city. In December 2014 fighters from the group breached the base's security perimeter before engaging troops in a gun battle that lasted several hours and killed at least three soldiers.

The AMISOM force, deployed to Somalia since 2007, currently has some 22,000 soldiers from Kenya, Ethiopia, Uganda, Burundi and Djibouti.

They have managed to push al-Shabab out of the capital, but the group still holds large swaths of territory and frequently launches hit-and-run attacks.