The government forces attempted to drive their rivals from Dhobley, a town near the Kenyan border, but were repulsed by the hardline insurgents.
"Our forces carried out a military operation in Dhobley district this morning. We killed many of the violent elements before we peacefully returned to our positions," Mohamed Deeq Hassan, Somali government officer in a nearby village, told AFP by phone.
Local elder Abdullahi Mohamed Adan said around 12 fighters were killed. Other witnesses gave a similar death toll.
"The town is calm now and the Shebab fighters are still controlling the area as the Somali government forces were pushed back in the fierce fighting," Adan said.
Somali government troops and other allied fighters recently launched a military drive to wrest back control of the war-riven Horn of African state largely in the hands of the hardline rebels.