MOGADISHU, Somalia - Somalia's government claimed victory over an Islamic insurgency Thursday just hours after a surge in violence killed 58 people in the capital, but diplomats said they were skeptical the worst fighting in more than 15 years had ended.

Somali troops and their Ethiopian allies have been trying to wipe out the insurgents since late March, with the unrelenting rain of mortar shells and artillery taking the highest toll on civilians. Rights groups say the fighting has killed more than 1,000 people and sent up to 400,000 fleeing for safety.

Machine-gun and artillery fire could still be heard in the south of Mogadishu, a wrecked coastal city of two million people. Fifty-eight people, mainly civilians, were killed in fighting early Thursday as the Ethiopian and government forces drove insurgents out of their stronghold in the north of the city, according to Somalia's Elman Human Rights Organization.

In the past nine days alone, the death toll reached more than 400.

"We have won the fighting against the insurgents,'' Prime Minister Ali Mohamed Gedi told The Associated Press, saying small, mopping-up operations were still under way and that more than 100 insurgents had surrendered to the government.

"The worst of the fighting in the city is now over,'' he said.

However, Western diplomats said that though the insurgents had suffered large numbers of casualties and were running low on ammunition, they were not yet defeated. They spoke on condition of anonymity for fear of damaging relations with Somalia's government.

"People can now return to their homes,'' Gedi said. "The rest of the fighting will be over soon. We have captured the stronghold of the terrorists. We will capture any terrorists who have escaped.''

Somalia is facing a dire humanitarian crisis after the fighting levelled homes and sent hundreds of thousands of civilians into squalid camps or seeking shelter along roadsides.

The United Nations' top humanitarian official said Thursday that more people have been displaced in Somalia than anywhere else in the world this year. And, he said, international aid groups only have access to a fraction of them.

"The situation is indeed extremely worrying,'' said John Holmes, the UN undersecretary general for humanitarian affairs. While UN agencies and other relief groups are trying to provide aid, they can only reach about 60,000 of the homeless at the moment because of fighting in and around the capital of Mogadishu.

The insurgents are linked to the Council of Islamic Courts, which was driven from power in December by Somali and Ethiopian soldiers, accompanied by U.S. special forces. The U.S. has accused the courts of having ties to al-Qaida.

The militants reject any secular government, and have sworn to launch an Iraq-style insurgency.

Gedi said he was confident the group would not re-emerge because the government and allied forces were seizing the insurgents.

"They are not getting away, we are capturing them, we are bringing them to justice,'' he said. "That is the difference compared to what happened in December.''

Earlier Thursday, Ethiopian tanks and artillery had pounded the northern stronghold, as ceasefire talks foundered and rumours spread that a top Islamic rebel had arrived in the capital. But most of the heavy guns fell silent by midmorning.

Bodyguards linked to a top Islamic extremist, Sheik Hassan Dahir Aweys, arrived in Mogadishu on Wednesday, sparking rumours that Aweys and leaders of the extremist Shabab movement were leading the fighting against the Somali and Ethiopian troops.

Most of the leadership of the Council of Islamic Courts has either fled the country, or been in hiding since Ethiopia intervened in December to prop up the government.

The Shabab have taken credit for a string of suicide bombings against Ethiopian troops.

Somalia has not had an effective national government since 1991, when warlords overthrew dictator Mohamed Siad Barre and then fought one another, throwing the country into anarchy. The current administration was formed in 2004, but has struggled to extend its control.