Somalia's government has requested an explanation from the United States for an air raid that it says killed 22 soldiers and civilians in the north of the country.

Officials in the semi-autonomous region of Galmudug said a US bombing killed members of its forces and accused a rival region, Puntland, which is also semi-autonomous, of misleading the US into believing those targeted were members of the al-Shabab armed group.

Al Jazeera goes on the trail of a Somali army commander accused of involvement in mass killings and war crimes.

"The cabinet requests the US government give a clear explanation about the attack its planes carried out on the Galmudug forces," a government statement said.

It also urged both Galmudug and Puntland, which have often clashed over territory in the past, to mend relations, the Reuters news agency reported.

Washington said the United States carried out a "self-defence air strike" after Somali troops faced fire from al-Shabab fighters. It said nine fighters had been killed but that it was looking into reports others may also have died.

The United States, a major donor to Somalia's government in Mogadishu, has often bombed al-Shabab positions and commanders in a bid to support the government.

'Al-Shabab not in the area'

Al-Shabab has been waging a war against the central government for nearly a decade, carrying out often major attacks on military and civilian targets.

Since being pushed out of major cities and towns, the group has resorted to armed attacks across the Horn of Africa country and in other countries in the region such as Kenya.

In a separate statement, Somali General Ali Bashi said the Somali army had confirmed that Galmudug forces and civilians were killed in the raid, describing it as a case of "friendly fire".

The general also said that al-Shabab was not in the area, confirming an earlier statement from the rebels that they had no forces there at the time of the attack, which happened overnight from Tuesday to Wednesday.

Protesters in Galmudug's capital Galkayo burned US flags and images of President Barack Obama in protest on Wednesday, witnesses said.

Somalia has been struggling to rebuild after two decades of war. The conflict that began in 1991 has left the country riven by clan rivalries and struggling with the conflict between the government and al-Shabab.

Source: Agencies