In the hidden ravines and forbidding, dust-colored mountains of a remote border region near Afghanistan, about 25,000 Pakistani troops are battling hundreds of well-armed foreign militants and Pakistani tribesmen in an increasingly violent confrontation that is imposing growing costs on civilians and prompting warnings of wider unrest.

The government has stepped up the intensity of its attacks in the tribal zone of South Waziristan after a series of failed attempts this year to negotiate the surrender of the foreigners, identified by U.S. and Pakistani officials as being allied with al Qaeda, most of them from Chechnya and Uzbekistan. The ethnic Pashtun population of the region has traditionally paid little heed to dictates from Islamabad.

On Sept. 9, for example, an airstrike and subsequent assault by helicopter gunships on a fortified compound in the Dila Khula district of South Waziristan killed as many as 100 people, including foreign militants and some noncombatants, according to foreign diplomats and reports by Pakistani journalists based in the region.

The militants and their local supporters have struck back with a vengeance, staging daily ambushes and rocket attacks on Pakistani paramilitary and army forces, according to the same sources, who said scores of soldiers and officers have been killed since the army began its offensive in March.

This month, a small force led by a local tribesman -- said by local news reports to have been recently released from the U.S. military prison at Guantanamo Bay, Cuba -- cut a major road between South and North Waziristan. The army reopened the route several days ago, according to Maj. Gen. Niaz Khattak, the division commander in the region.

Although the army does not disclose official casualty figures, it is clear that the costs to the government are mounting: On Saturday, foreign and Pakistani journalists who were flown by helicopter to the army's main base in Wana, the commercial and administrative center of South Waziristan, saw wounded, heavily bandaged soldiers being carried off an ambulance and loaded aboard another helicopter for evacuation.

"When you're operating against such a force -- a well-trained force, well-equipped, technologically capable, with resources, in treacherous areas, mountainous areas, one must expect casualties," Gen. Pervez Musharraf, Pakistan's president and army chief of staff, said in an interview last week. But he added, "Until we meet success, the operation will go on."

The army's newly aggressive posture has been welcomed by the U.S. and Afghan governments, both of which have been urging Pakistan to act more forcefully against foreign militants, some of whom are Arab members of al Qaeda, as well as Taliban fighters who use the border area as a refuge and base for attacks against U.S. and Afghan troops.

But the offensive has sparked a political backlash in the tribal region as well as among religious parties that wield considerable influence in the government. Critics of the operation accuse Musharraf of subordinating national interests to those of the United States, warning of a potential insurrection in a traditionally lawless realm where no household is complete without a Kalashnikov assault rifle and an ample supply of bullets.

Several months ago, a group of clerics associated with the religious parties issued a fatwa, or religious edict, asserting that government troops killed in the Waziristan operation should not be accorded Muslim burial rites.

"People in Waziristan have now taken up arms against this senseless operation," said Maulana Mairajuddin Khan, a member of parliament from South Waziristan, disputing government charges that local tribesmen are aiding the foreigners. "It has nothing to do with the propaganda that the locals want to protect the foreigners. Why the hell would we protect foreigners at the cost of our lives and livelihood?"

Nisar Wazir, a school principal in Wana, said in a telephone interview that he has "documented nine cases of indiscriminate shooting and aerial bombings against the targets where only locals were present." He also criticized government economic sanctions against local tribes that he said have led to food shortages in the region.

Khattak and army officials say the government has acted with restraint, recalling its offers of an amnesty for foreign militants who turn themselves in and register with authorities. "What bigger concession can there be?" Khattak said. But he said the militants and their Pashtun supporters gave the army no choice but to toughen its approach after they spurned the amnesty deal and murdered local officials; the bodies of two of them were mutilated and dumped in a well last spring.

Khattak said the army takes extreme care to avoid civilian casualties, although he acknowledged that "we also have problems of differentiating between miscreants and peace-loving citizens."

Assessing the truth of the situation in South Waziristan is extremely difficult because of its remoteness and inaccessibility. The International Committee of the Red Cross and other humanitarian aid groups have been denied entry to the region, on the grounds that the army is engaged in a law enforcement operation and not armed conflict as defined by the Geneva Conventions, according to an official from an aid agency who spoke on condition of anonymity. Foreign journalists also have been barred from traveling independently to the tribal areas, although the army occasionally escorts them there on tours, as it did on Saturday.

Such visits are carefully controlled. After a briefing by Khattak at the army's heavily fortified compound in Wana, army officials accompanied the journalists on a short helicopter ride to the Shakkai valley, about 15 miles north of Wana, to inspect the ruins of a compound that was said to have been used by foreign militants before it was destroyed by a precision airstrike in June.

Local army commanders then introduced a handful of Pashtun residents of the valley, who confirmed that the compound had indeed been used by foreign militants under the protection of two local tribesmen. Once the army officials were out of earshot, however, one of the tribesmen, Noor Murad Aidi, expressed anger over the army's tactics in an interview with a Pakistani journalist from the private Geo television network.

"This is an oppressor army," Aidi complained, adding that the June attack had "killed innocent people."

Pakistani authorities have estimated that as many as 600 foreign militants are hiding in the border area, mostly in South Waziristan, although military officials said Saturday that the number could have been whittled down by as much as half. Most are said to have sought refuge in the area after the collapse of the ruling Taliban militia in Afghanistan in late 2001. Khattak said the militants range in age from 18 to 35 and described them as well-trained, well-educated and highly motivated. Many are equipped with sophisticated arms as well as binoculars, Thuraya satellite phones and hand-held satellite navigation devices, he said.

After Khattak's briefing, army officials displayed equipment and supplies -- including heavy-caliber ammunition, Arabic-language explosives manuals and desktop computers -- recovered from a basement discovered this month under one of the compounds destroyed in June in the Shakkai valley.

Pakistani officials said that they moved troops into South Waziristan earlier this year after the United States provided Musharraf with irrefutable evidence that the region was serving as a base for launching terrorist operations in Afghanistan and the major cities of Pakistan. "There was no way we could have disputed the intelligence provided by the U.S. in form of satellite imagery and other material," said an intelligence official in Peshawar, the capital of North-West Frontier Province, which includes South Waziristan. "In every case, we made our own independent confirmation, and each time, the precision of the American information shocked us."

Khan reported from Karachi.

Pakistani soldiers congregated near a destroyed hideout of militants linked to al Qaeda during a military exercise in Wana on Saturday. Men in Wana view an artillery shell fired by militants. Resistance to government attacks has been forceful.A Pakistani paramilitary soldier takes position at a post on the outskirts of Wana on Sept. 9, when a government assault killed as many as 100 people.