By Sahra Abdi

MOGADISHU (Reuters) - Residents fled Afmadow in southern Somalia Tuesday as al Qaeda-linked rebels rushed in reinforcements and dug defenses around the town in anticipation of clashes with advancing Kenyan-backed government troops.

Afmadow resident Hussein Osman Roble said warplanes were swooping low in the skies above the rebel stronghold but that there were no signs yet of Somali or Kenyan troops on the outskirts of the town.

"Most residents have been fleeing since yesterday toward Dhobley," Roble told Reuters by telephone from inside Afmadow, referring to the border area now cleared of militants according to Kenyan military sources.

It was not immediately clear how far Kenyan and Somali forces were from Afmadow. They had been reported passing through Qoqani, about 30 km to the west, Monday. One pro-government militia commander said late Monday he was 7 km from the town.

Kenya launched an offensive with Somali forces Sunday in a high-stakes bid to secure its porous border with its anarchic neighbor after a wave of kidnappings by gunmen thought to be linked to the rebels.

Al Shabaab threatened to take the "flames of war" back across the frontier if Kenya did not withdraw its troops.

The militants denied they were behind the abduction of four foreigners in three separate incidents along the Kenyan coast and a refugee camp in the past few weeks and said the kidnappings were being used as a pretext for the incursion.

Somalia's al Shabaab rebels said Kenyan forces were 100 km (62 miles) inside Somali territory. Residents in Afmadow had said the advance of ground forces would likely be slowed by heavy rains that had lashed the region.

"Jets have flown low over Afmadow, terrifying the residents, while al Shabaab is digging trenches and tunnels for defense inside and around Afmadow," Roble said.

The militants have scrambled columns of fighters and dozens of battle-wagons mounted with heavy machine guns as remaining residents braced for fierce clashes.

Residents in the rebel-controlled port city of Kismayu, the nerve center of rebel operations in the south, said dozens of rebel trucks raced out of the coastal city Monday.

A resident in Dhobley said the border town was calm overnight.

The Islamist militants, who have wrested control of much of Somalia from a weak internationally backed interim government and warlords, have threatened retaliatory attacks on Kenya.

East Africa's biggest economy has long looked nervously at its anarchic neighbor and its troops have made brief incursions into Somali territory in the past.

The latest operation is a major escalation in military involvement and risks dragging Kenya deeper into Somalia's two-decade civil.

Horn of Africa analysts said Kenya did not have the capacity or the will to "occupy" Somalia's border areas and would look to Somali forces and government allied militia to hold onto territory cleared of al Shabaab.

(Reporting by Sahra Abdi; Writing by Richard Lough; Editing by Karolina Tagaris)