A homicide bomber killed 30 people attending Friday prayers at a mosque, the latest violence to rock Pakistan's northwest just as the army says it is beating back the Taliban in the Swat Valley.

The attacks came as U.S. envoy Richard Holbrooke met with top Pakistani officials, including the prime minister, who requested the U.S. write off Pakistan's debt to help it tackle challenges including some 3 million Pakistanis made refugees by the Swat offensive.

Pakistani leaders insist they are serious about wiping out militancy in Swat, a one-time tourist haven that largely fell under Taliban control over the past two years. The U.S. backs the operation and sees it as a test of the government's resolve in taking on Al Qaeda and Taliban militants along the Afghan border region.

The generally broad public support in Pakistan for the operation, however, could falter if militant violence spikes in reaction. There already have been attacks in major cities such as Peshawar and Lahore that officials suspect were revenge by the militants for Swat.

There was no immediate claim of responsibility for the attack on the Sunni Muslim mosque in the Haya Gai area of Upper Dir, a rough and tumble district next to Swat. It was unclear if sectarian differences played a role, though the area is primarily Sunni.

"The latest report I just got is that 30 dead bodies have been identified. I cannot say how many more are dead, but there are scores of more wounded in the blast," Upper Dir district coordination officer Atif-ur-Rehman told The Associated Press by phone. He said a homicide bomber was involved and that rain and the far-flung nature of the area hampered rescue work.

Meanwhile, four soldiers were killed by a roadside bomb in South Waziristan, according to two intelligence officials who spoke on condition of anonymity because they were not authorized to speak to the media on the record. South Waziristan is a tribal region bordering Afghanistan that some suspect will be the next site of Pakistani military action against the Taliban.

Civilians displaced by the Swat offensive have been impatient to return home.

An AP reporter saw hundreds of Swat residents at Got Koto, an area just outside the valley, on Friday. The residents had heard reports the government would lift a curfew in the main town of Mingora to let them go back. But security forces on a main road stopped them, saying they could not allow civilians back in yet.

"I want nothing from the government. I only want that we should be allowed to go back to our Mingora city," said Dilawar Khan, 40, as his four children and two wives stood by him under the shade of a tree. Khan and his family had been staying at a relief camp in Mardan.

Zubayda Bibi, one of the wives, complained about conditions at the camps. "We can no longer sit at the camps where there is only dust, diseases and heat," she said. Even if damaged, "home is better than anything."

The army launched its latest operation in Swat about month ago after the militants undermined a peace deal brokered earlier this year by infiltrating a neighboring district just 60 miles from the capital, Islamabad.

The army's top spokesman has estimated it will take at least another two months before the Swat Valley is cleared of militants. The military expects to stay in the region at least another year, largely because the area lacks a solid police presence. The offensive has also covered the areas of Buner and Lower Dir.

During a briefing with commanders Thursday, army chief Gen. Ashfaq Parvez Kayani said the tide in Swat had "decisively turned" and that major population centers and roads leading to the valley were rid of Taliban resistance. But he said security forces were still hunting top Taliban commanders and that isolated incidents of violence would likely continue.

About 160,000 of the displaced Pakistanis are now living in relief camps. The U.S. has pledged $110 million to help the refugees. Holbrooke said this week the White House hopes Congress will agree to at least $200 million more in aid.

In a meeting with Holbrooke on Friday, Prime Minister Yousuf Raza Gilani urged the envoy to push the U.S. to write off Pakistan's debt to give the economically struggling country additional relief. A statement from Gilani's office did not specify how much money Pakistan owes the United States.