Al-Qaeda-aligned militants are withdrawing from their last major stronghold on Somalia’s southern coast, residents in Barawe have told the BBC.
They said that al-Shabab battle-wagons loaded with their weapons had been leaving since the morning.
African Union forces and Somali government troops have been closing in on the town – an official says they are about 20km (12 miles) away.
Barawe is in a strategic position 200km south of the capital.
The African Union says the militants have been using it as a base to launch attacks on the capital, Mogadishu.
Residents of Barawe said that as they withdrew the insurgents told them they were going to set up defences outside the town to save civilians from being injured in any fighting.
Al-Shabab has lost control of several small towns in the past month but still controls large swathes of territory in rural areas.
The group, which is estimated to have at least 5,000 fighters, wants to overthrow the UN-backed Somali government and has imposed a strict version of Sharia in areas under its control.
Last week, a woman was stoned to death in Barawe for alleged adultery.
Correspondents say that al-Shabab tends to tactically withdraw from areas when faced with a large offensive, but leaves some fighters within the civilian population to launch attacks later.
Various armed groups have been battling for control of Somalia since the overthrow of President Siad Barre in 1991.