ISLAMABAD – Pakistan will defeat the Taliban militarily but could lose the public relations war if it fails to help the hundreds of thousands of people displaced by the fighting, Prime Minister Yusuf Raza Gilani said on Thursday.

The army launched an offensive in the Swat valley, northwest of Islamabad, last week after the United States accused the nuclear-armed country's government of abdicating to the militants.

At least 830,000 people have fled from their homes, joining more than 500,000 displaced by earlier fighting in the northwest.

U.N. High Commissioner for Refugees Antonio Guterres, visiting a camp for the displaced, said Pakistan needed massive international help to avert a tragedy.

Gilani said the government planned a conference of aid donors but said he also expected the Pakistani people to help.

Militarily we will win the war but it will be unfortunate if we loose it publicly, Gilani told the National Assembly.

Most political parties and members of the public support the offensive, despite widespread doubts about a close alliance with the United States in its campaign against militancy.

But opposition will grow if many civilians are killed in the fighting or if the displaced are seen to be enduring undue hardship.

The offensive was launched when President Asif Ali Zardari was in Washington assuring the United States his government was not about to collapse and was committed to fighting militancy.

Pakistani action against militants in its northwest is vital for U.S. efforts to defeat al Qaeda and stabilize neighboring Afghanistan.

About 15,000 members of the security forces are facing about 5,000 militants in the Swat region, the military says.

The military said there had been heavy fighting in a Taliban stronghold in the Peochar valley, a side valley running northwest off the main Swat valley, and in an area near the region's main town, Mingora, which the Taliban still hold.

The operation is progressing well ... We have achieved considerable progress, military spokesman Major-Genral Athar Abbas told a briefing.

Abbas said 54 militants and nine soldiers had been killed in the previous 24 hours. That would take the toll to more than 800 militants and 45 soldiers. Reporters have left Swat and there was no independent confirmation of the casualties.

The military has said there have been no reports of civilian casualties in its actions as soldiers were targeting militants in mountains and urban warfare had not started. Though Abbas said that would come.

MORE DRAMATIC

Army chief General Ashfaq Kayani visited soldiers in Swat and reiterated the army's resolve to flush militancy from the area and defeat the gunmen, the military said.

There are fears militants will step up attacks elsewhere in response to the offensive. Gunmen ambushed an army convoy in North Waziristan on the Afghan border with a bomb and gunfire and two soldiers and a militant were killed, security officials said.

Residents began fleeing late last month when the army attacked the Taliban in two districts near Swat they had occupied in violation of a February peace pact aimed at ending violence in the former tourist valley.

Gilani said the displacement was unprecedented in the country's history and the government had to win the hearts and minds of those forced from their homes.

The U.N. refugee agency said only about 80,000 of the displaced were staying in camps, with the rest with friends, relatives, or in rented accommodation or in spontaneous settlements that were springing up.

In urging international assistance, Guterres told reporters in the Yar Hussain camp he was appealing to the international community's enlightened self-interest.

What I'm concerned about is that if there's no positive response by the international community to supporting the Pakistani people then it'll make the situation of the country more dramatic in all aspects, he said.

Pakistan has experience of dealing with large numbers of homeless in cooperation with aid agencies. About 3.5 million people lost their homes in a 2005 earthquake in northern mountains and the army led a successful effort to feed and shelter the victims through a harsh winter.