NAIROBI, Kenya, Oct. 27, 2006 (AP) -- There are thousands of foreign troops inside Somalia and their presence could lead to "an all out war" between Somalia's transitional government and an Islamic group that controls much of the country, according to a confidential U.N. report obtained by The Associated Press.

The report dated Oct. 26 cites diplomatic sources in estimating that "between 6,000-8,000 Ethiopians and 2,000 fully equipped Eritrean troops are now inside Somalia supporting" the internationally recognized government and the Islamic group known as the Council of Islamic Courts.

"Both sides in the Somali conflict are reported to have major outside backers - the government supported by Ethiopia, Uganda and Yemen; the Islamic courts receiving aid from Iran, Libya, Saudi Arabia and Gulf States," the report added.

The briefing paper was written to help senior U.N. officials map out a strategy on how to provide aid to one of the most impoverished countries in the world, one that has not had an effective central government since 1991.

"In order for us to do this, a clear policy of engagement with the (Islamic courts) must be put in place," the report said. "The fact is that there is new found stability in Mogadishu, extending to areas that they have begun to control, which has not been seen for many years."

One problem facing the United Nations is the listing of the Islamic courts' leader, Sheik Hassan Dahir Aweys, on a list of people with ties to terrorism. U.N. policy severely restricts how much contact U.N. officials can have with people with alleged ties to terror organizations.

Both the transitional government and the Council of Islamic Courts have been girding for battle. Government forces, supported by Ethiopian military advisers, have been seen digging trenches near Baidoa, the only town the U.N.-backed government controls.

The Islamic courts have deployed forces at a strategic town between Baidoa, and their headquarters in the capital, Mogadishu, 150 miles to the southeast.

Ethiopian officials have insisted they have only a few hundred military advisers assisting the government, but international and local officials have previously put the number in the thousands.

Islamic leaders called for nationwide protests on Friday against Ethiopian troops in Somalia. Some Islamic leaders have called for a holy war against Ethiopia until it pulls its forces out of Somalia.

The Somali transitional government has repeatedly accused Eritrea of arming and supporting their rivals in the Islamic courts, something that both Eritrean and Islamic officials have repeatedly denied.

Ethiopia and Eritrea fought a two-year border war that remains unresolved. The top U.S. diplomat to Africa, Jendayi Frazer, last week accused Eritrea of using Somalia to open a second front against Ethiopia.

In Washington on Thursday, U.S. State Dept. spokesman Sean McCormack called on Ethiopia and Eritrea not to further aggravate the tense situation in Somalia.

"This is a country that has been ravaged by violence and civil conflict for decades and it's a sad story, so we would hope that countries in the region would try to play a positive role ... to not take any steps that would aggravate what is already a very tough, sad situation," he said.

The U.N. refugee agency said Friday that the flow of Somali refugees into neighboring Kenya had slowed down, but expressed concerns over reports the Islamic courts were preventing people from leaving Somalia.