Somali government forces have taken full control of a strategic town where a Cabinet minister was killed by rebels last month.
Government officials and residents say hundreds of soldiers entered western parts of Beledwenye early Sunday after exchanging gunfire with militants who withdrew.
At least one soldier was reported to be injured.
Beledweyne, the capital of Hiran province, lies near Somalia's border with Ethiopia, about 300 kilometers north of Mogadishu.
Last month, a suicide bombing in the town killed Somalia's national security minister and 20 others. The Islamist militant group al-Shabab claimed responsibility for the attack.
Al-Shabab and an allied group, Hizbul Islam, are fighting to topple the Somali government and set up a strict Islamic state.
Hundreds have died since the groups launched an offensive in Mogadishu in early May. Since then, more than 220,000 people have fled the Somali capital.
Somalia has endured nearly two decades of war and conflict since the fall of the country's last stable government in 1991.
Some information for this report was provided by AP.