Islamist fighters withdrew overnight from almost all their bases in the famine-struck Somali capital, the most significant gain for the embattled U.N.-backed government here in four years.

Somali and African Union commanders toured newly abandoned positions Saturday, including a former sports stadium. Tanks belonging to the A.U. peacekeeping force surrounded the former militia base.

The Islamists, who call themselves al-Shabab, have denied many aid agencies access to their territory, and their presence in the capital has complicated famine relief efforts. The government said humanitarian agencies are now welcome to come and distribute aid, but many aid workers still insist on serving only precooked rations at guarded kitchens.

“It is of major significance, but the war is not over yet,” said Somali Defense Minister Hussein Arab Esse, standing amid rubble and graffiti-daubed walls at the stadium.

Somalia has been a failed state for more than 20 years. Its lawless wastes are a haven for pirates and international terrorists, and the years of conflict have caused two major famines, including this one.

Al-Shabab controlled roughly a third of the capital until Saturday morning. Its members carried out public amputations and executions and forcibly recruited children as fighters. The militia still holds most of southern Somalia, where tens of thousands of people are estimated to have starved. Many have fled to shelters in and around the capital.

It is unclear why al-Shabab retreated or what its next move will be. Observers cite several possible reasons: the drought and the movement of population away from areas it controls; the diversion of foreign fighters and funding to the Arab Spring; or infighting among top leaders. Or, they say, it could be a change of tactics to a guerrilla-style campaign of suicide bombings and hit-and-run attacks.

Al-Shabab spokesman Ali Mohamed Rage told a local radio station that forces had made a tactical withdrawal and would soon launch a counterattack. “We shall fight the enemy wherever they are,” he said.

Somali Prime Minister Abdiweli Mohamed Ali estimated that the militants had vacated 90 percent of the capital and said that forces were checking the rest.

— Associated Press