Witnesses said civilians were among the dead, some with their throats cut
Most of the Somali children captured during a raid on a mosque have now been released, the police say.
Amnesty International had called for the release of the 41 boys taken from the al-Hidaya mosque in the capital, Mogadishu.
Ethiopian troops said they had detained the boys because they suspected they were being trained as insurgents.
About 80 people were killed this week during fierce fighting between Ethiopian troops and Islamist fighters.
Among the dead were religious leaders from the Tabliq Sufi sect, which had stayed out of the conflict.
The UN emergency relief co-ordinator John Holmes has called for action against those involved in the attack.
Mr Holmes said there had been an increasing trend of indiscriminate use of force against civilians by all parties in the conflict in contravention of international humanitarian law.
Prime Minister Nur Hassan Hussein says the government was defending itself during the weekend clashes.
The recent fighting is threatening plans for reconciliation talks between the interim government and the Somali opposition alliance which includes the Islamists.
The Ethiopians intervened in 2006 to help government forces oust Islamists who had taken control of much of southern Somalia.
The UN says that more than half of Mogadishu's population has fled recent fighting in the city.
The country has not had an effective national government since 1991.