Ahmed Shire Falagle, information minister for regional Galmudug state, said that in the ensuing clash between the two groups, the army and the militias also captured El Gorof and Wabho, towns which had been in al Shabab control for almost 10 years.
"We are determined to liberate all the towns which are controlled by al Shabaab. As we pursued them, six of our soldiers were wounded," he told reporters.
Falagle said he believed al Shabab fighters had carried away some of their dead fighters.
"There was no fierce fighting. Al Shabab was chased and pursued. Al Shabab ran away, leaving weapons and at least 20 dead fighters," Falagle added.
The insurgent group was not immediately reachable for comment.
Al Qaeda-linked al Shabab has been under pressure since August, when President Hassan Sheikh Mohamud began an offensive against them, supported by the United States and clan militias known locally known as macawisley, or "men with sarongs".
The group has killed tens of thousands since 2006 in its fight to overthrow Somalia's central government and implement its interpretation of Islamic law.