Heavy fighting broke out in Somalia's capital of Mogadishu Friday as African Union (AU) peacekeepers backed al-Shabab Islamist militants to the outskirts, seizing rebel bases beyond the city's limits for the first time.

In the biggest joint offensive by the government and the AU forces, AMISOM [African Union Mission in Somalia], since August 2011, nearly 1,000 soldiers, supported by nearly 20 tanks, captured three al-Shabab bases, a senior security official said.

This is the first time AMISOM has been able to secure an area outside the parameters of the city, allowing them to defend greater Mogadishu from the exterior, said AMISOM spokesman Paddy Ankunda in a statement.

We are moving out of the city now so we can defend the city from outside now. Our troops have captured strategic bases from al-Shabab.

Mogadishu University and Barakat cemetery were also seized as forces advanced north, Ankunda said. Hundreds of residents fled a northern Mogadishu neighborhood after hearing sounds of mortars and gunfire.

Al-Shabab, which is also being pressured by Kenyan military forces in Somalia's south and Ethiopian forces in the west, have held onto small pockets of resistance, despite being pushed out of the city over the last year, The Associated Press reported.

Still, Mogadishu has been subjected to near daily insurgent attacks. On Thursday, a bomb, which appeared to target a police checkpoint, exploded near a crowded area of makeshift refugee shelters; six people were killed in that blast.

The violence coincides Friday with the six-month mark since the United Nations first declared a famine in six regions of southern Somalia -- an estimated 50,000 to 100,000 have been killed as a result.

Somalia hasn't had a functioning government in more than 20 years. Infighting has paralyzed the current transitional government, whose mandate ends in August.