Ethiopian troops and Somali government forces have seized control of a key rebel-held town in Somalia after battling al-Qaida-linked militants.

Somali officials say the fighting began early Saturday after Ethiopian and Somali forces attacked positions held by al-Shabab fighters on the outskirts of Beledweyne, about 30 kilometers from the Ethiopian border.

A resident of Beledweyne told the French news agency AFP that 18 people, most of them militants, died in the fighting.

But al-Shabab denied it was defeated and said many Ethiopian troops were killed in the clashes.  The militant group said it carried out a planned withdrawal from Beledweyne after the fighting.

Saturday's assault on Beledweyne marks the third location in Somalia where militants have been challenged.  Control of the town has changed hands often in recent months as different militias push to seize control of it.

African Union troops have mostly forced al-Shabab out of the Somali capital, Mogadishu, and Kenyan troops are battling militants in the south.

Somalia has been mired in anarchy since warlords toppled military dictator Mohamed Siad Barre in 1991.

Some information for this report was provided by AP, AFP and Reuters.