MINGORA, Pakistan - People trapped at home for weeks emerged in search of food at barren shops while corpses lay exposed in the Swat Valley's main city yesterday, and a Pakistani official suggested the army offensive against the Taliban in the region could end in days.

Elsewhere near the Afghan border, dozens of militants died in clashes with soldiers in a tribal area, fighting that could nudge the military to expand its offensive beyond Swat.

A reporter who visited Mingora a day after the army declared it secured saw many damaged buildings. Two decomposing bodies, apparently of insurgents, lay unburied in a cemetery; a third corpse lay charred near a mall. The smell of explosives hung in the air.

"We have been starving for many days. We have been cooking tree leaves to keep ourselves alive. Thank God it is over," Afzal Khan said. "We need food. We need help. We want peace."

Pakistan launched its offensive against militants in Swat and surrounding districts after they violated the terms of a cease-fire and advanced into a region close to the capital, Islamabad.

Speaking in Singapore, Pakistan's defense secretary predicted the army would clear remaining militant strongholds in the valley in "two to three days." Pakistan's military spokesman said that assessment was overly optimistic.

The Swat offensive has earned U.S. praise as troops have regained large swaths of the region from an estimated 4,000 militants. The fighting has forced up to three million people to evacuate.

In the south Waziristan tribal region, meanwhile, insurgent attacks on an army convoy and checkpoint Saturday night sparked clashes that left scores dead. About 50 militants and two soldiers were killed, according to two intelligence officials who spoke on condition of anonymity because they were not authorized to talk to the media.

A military statement yesterday said that at least 25 militants and seven soldiers died in south Waziristan, the main stronghold of Pakistani Taliban chief Baitullah Mehsud. Qari Husain Ahmed, a Taliban commander in south Waziristan, disputed both accounts, saying via phone that only two militants died.

The differences could not immediately be reconciled.

Most of Mingora's roughly 375,000 residents fled before or during the offensive. The military briefly lifted a curfew yesterday, allowing some of the 20,000 or so who remained to buy provisions in the few shops that were open.

Ali Rehman said he had not left his house for 25 days.

"I never knew who was fighting and who was being killed," he said, clutching two bags of flour. "I need help to keep my family alive because I do not have any source of income anymore."

Officials from the International Committee of the Red Cross visiting other parts of the valley Saturday were alarmed.

"People have been blocked for weeks," team leader Daniel O'Malley said in a statement released yesterday. "There is no running water, no electricity, and food is scarce. There is no fuel left for generators, and most medical facilities in the district are no longer functioning. Phone lines are down, so people have been cut off from the outside world and are anxious for contact with relatives who fled the area."

The military said that relief work was proceeding in Mingora but that it would be at least two weeks before power is restored there, so refugees were not being encouraged to return home.