Mogadishu (AFP) - Rival militia forces have clashed in central Somalia, the United Nations said Saturday, as it called for troops to pull out from contested zones in the town of Galkayo.

Fighting broke out between gunmen loyal to the Puntland and Galmudug districts, with reports of heavy gunfire as well as mortars or artillery, and hundreds of civilians fleeing.

"Fighting in Galkayo must stop now," UN envoy Nicholas Kay said, warning that "shelling civilian areas may be a crime against humanity or war crime."

Galkayo, which straddles the border between the two districts, has seen frequent clashes between rival political or clan groups, separate from the Islamist Shebab insurgents who are fighting the internationally-backed central government in Mogadishu.

Tensions have been high since fighting erupted on November 22, when at least six people were killed and dozens injured, the UN said in a statement.

The rivals agreed a ceasefire, but that appears to have now collapsed.

"We call on the leadership of Puntland and Galmudug to resolve their differences through peaceful dialogue," the UN and regional IGAD bloc said in a statement, also signed by the United States, European Union, Britain, Sweden and Italy.

"We also urge these leaders to instruct their security forces to stand down, and conduct an orderly withdrawal from the line of division separating the northern and southern districts of Galkayo city in order to prevent further bloodshed.