Hundreds of foreigners fighting alongside Somali Islamic insurgents have driven this week's fierce battles against government forces, which have killed more than 100 people, the U.N. envoy to Somalia said Friday.

Concern that the government might fall is mounting. Observers fear that if the Al Qaeda linked insurgents seize the capital, they will gain a safe haven on the Horn of Africa.

The U.N. Security Council on Friday condemned the upsurge in fighting and gave strong support to the country's leaders. A statement approved by all 15 council members demanded that opposition groups immediately end their offensive, renounce violence and join reconciliation efforts.

Somalia's coastline borders an important sea trade route and the Horn juts into the Indian Ocean just below the oil-rich Arabian peninsula.

The government controls only one major road in the capital, Mogadishu, along with some government installations, with the assistance of about 4,350 African Union troops.

The fighting has frightened even longtime residents of the battle-scarred capital. During a lull Friday, people streamed out of their homes seeking food or safer quarters.

The U.N.'s envoy to Somalia, Ahmedou Ould-Abdalla, charged Friday that between 280 and 300 foreign fighters were involved last weekend in an attempted coup against President Sheik Sharif Sheik Ahmed, a moderate Islamic leader.

"There is no doubt from sources overt and covert that in the attempted coup of last weekend there was significant involvement of foreigners, some from this continent and others from outside this continent," Ould-Abdalla told journalists in neighboring Kenya.

He said some of the foreigners were mercenaries and others were Islamic ideologues.

The African Union is concerned about the deepening influence of foreign fighters in Somalia's insurgency, said Nicolas Bwakira, the African Union envoy to Somalia. He said that there are up to 400 foreign fighters in the Horn of Africa nation.

"It would be unacceptable that the Shabab, Al Qaeda, takes over the government in Somalia. This is a group of war criminals," said Bwakira, referring to a Somali extremist Islamic group that is fighting the government. The U.S. State Department considers al-Shabab a terrorist organization with links to Al Qaeda, something the group denies.

Ould-Abdalla said he has offered to help Somalia's hardline Islamic leaders remove their names from a U.N. Security Council list of terrorists if they will work for peace.

"It is not in killing their own people that they will solve this problem," Ould-Abdalla said, referring to the terrorist designation. "On the contrary."

One on the U.N. list is hardline leader Sheik Hassan Dahir Aweys, leader of a faction of the Alliance for the Re-Liberation of Somalia. The leader of the other faction is Somalia's current president, the more moderate Sheik Sharif Sheik Ahmed.

Aweys has been based in the Eritrean capital, Asmara, since the umbrella Islamic group he led with Ahmed was ousted from Mogadishu and southern Somalia in 2006 by Ethiopian troops.

Ahmed returned to Mogadishu as president in February -- and Ethiopia withdrew its troops from Somalia -- under a deal mediated by Ould-Abdalla.

Aweys returned to Mogadishu in April, saying he wanted the African Union force out of Somalia, as well.

During this week's fighting, some government troops have defected to the insurgents, although the government denies it. The local television station HornAfrik has run video of Islamist fighters displaying 17 military vehicles with government plates they said were brought over by defecting soldiers.

Ahmed's spokesman, Abdulkadir Darnaamik told The Associated Press late Thursday that the insurgents had taken two government buildings, including Mogadishu Stadium, where the government kept weapons.

"No one has got the upper hand," said Darnaamik.

Residents have been fleeing for days, sleeping under trees and sheltering children under scraps of plastic. The streets are eerily quiet, the shops shuttered; even Friday's calls to prayer have been silenced in some areas of north Mogadishu.

Hawo Hussein said she was going to stay with relatives in a safer part of the capital.

"There is no hope that the two sides will stop fighting," Hussein said.

Her 2-year-old daughter was strapped on her back. Her son walked behind her.

She said if the violence gets worse she will flee to Kenya, where a 250,000 Somali refugees already live.

Residents described seeing insurgents, some with turbans wrapped around their faces, careering around the streets in pickup trucks bristling with weapons.

The few people who have remained to look after houses scurry across the streets during lulls in the violence, searching for food. They say the fighting is even more intense than when the Ethiopian troops supporting the government invaded in 2006.

The election of a moderate Islamist as president and the decision to implement Shariah law has failed to persuade the most hard-line elements to give up their struggle. Somalia, torn apart by clan militias, has not had an effective government for 18 years.