The anti-government group al-Shabab controls big swaths of Somalia [AFP]
At least 27 people have been killed in a failed offensive by Somalia's al-Shabab group near the Kenyan border, according to government forces.
Clashes broke out in the town of Balad Hawa on Thursday as residents headed to evening prayers.
Mortar fire reverberated through the streets until after midnight when al-Shabab fighters retreated.
"Al-Shabab attacked our defensive positions ... but we later defeated them and kicked them out of the town and surrounding areas," Sharif Abdiwahid, a spokesman for the joint force of government troops and Ahlu Sunna Waljamaca militia, said on Friday.
Witnesses said some of those killed were civilians.
"We are collecting the dead bodies this morning, five members from one family who were killed after artillery fire hit their house are among the casualties," Yahya Mohamed, a local resident, said.
Others said the fighting had triggered an exodus from the town, with hundreds fleeing towards Kenya and nearby Ethiopia.
"The town is empty now. We can say 90 per cent of the people have fled either to Mandera in Kenya or Dollow in Ethiopia," Barre Adan Shire, a Somali legislator and commander of a local pro-government militia, said.
Somali government forces took over the Balad Hawa last Sunday in an offensive launched to take back areas held by the group. Al-Shabab took control of the area in January 2009 after Ethiopian troops, who had entered to support Somalia's transitional government, withdrew from Somalia.
The UN-backed government has been promising a major offensive to stamp out al-Shabab for more than a year but the fighters still control three quarters of the country.
In reaction to the clashes in Balad Hawa, a Kenyan security officer at the border said scores of Kenyan troops had been deployed along the frontier.
Kenya has long been concerned about the situation in Somalia, where first warlords and now different armed groups have reduced government to haplessness.
Those living in Kenya's remote northeastern provinces have reported increasing cross-border raids by al-Shabab.
Twice hit by al-Qaeda-linked attacks, Kenya has trained thousands of Somali recruits to boost troops loyal to Sharif Ahmed, the Somali president.