PESHAWAR, Pakistan - Fierce fighting erupted in a restive Pakistani valley Wednesday, officials said, killing 25 militants and four soldiers and undermining the government's strategy of offering peace deals to pro-Taliban insurgents.

The military, already under U.S. pressure to crack down on militant sanctuaries, rejected a report that its intelligence agents have ties with al Qaeda-linked hardliners.

Pakistan's four-month-old civilian government has tried to curb militant violence through dialogue, but many outside the country fear peace deals have given Taliban and al Qaeda more freedom to operate.

Militants abducted at least 25 police and paramilitary troops in the northwestern valley of Swat on Tuesday, and clashes also left two troops and two militants dead.

The military responded with more force early Wednesday. Troops in Swat backed by helicopter gunships and armoured vehicles, exchanged fire with militants for several hours. The army announced an indefinite, round-the-clock curfew.

Chief spokesman for the Pakistani army, Maj.-Gen. Athar Abbas, said 25 militants -- including a senior commander -- were killed in the main clash after attacking a security post. Four soldiers, including an officer, also died in the gunbattle, he said.

Another group of about 70 militants tried to seize the market area of the town of Matta, Abbas said, but fled when reinforcements arrived at the town's police station.

"The situation in Swat is that curfew has been imposed and security forces have been given orders to take strict action wherever militants or miscreants are involved in such actions,'' he said.

It was not immediately possible to get independent confirmation of the casualty toll, and an aide to militant leader Mullah Fazlullah painted a different picture.

Muslim Khan, speaking to The Associated Press by telephone, said only five Taliban had been killed and claimed that the rebels had killed more than 30 security forces.

"The morale of our Taliban is high and security forces are retreating in several areas,'' he said.

A peace accord struck in May foresaw the release of prisoners and concessions on militant demands for Islamic law in return for an end to violence.

Followers of Fazlullah, a firebrand cleric who rallies support using a pirate FM radio station, last year seized tracts of the valley before an army operation drove them out. Scores were killed in the fighting.

The Swat agreement blazed a trail for negotiations with tribal elders and militants across Pakistan's border region.

While that approach has sharply reduced the number of suicide attacks in Pakistan, NATO complains that the talks and accompanying ceasefires have freed up militants to mount attacks across the border into Afghanistan.

The New York Times reported Wednesday that a top CIA official confronted senior Pakistani officials with evidence showing that members of the country's Inter-Services Intelligence agency have deepened their ties with some militant groups responsible for a surge of violence in Afghanistan, possibly including the suicide bombing this month of the Indian Embassy in Kabul.

Its sources were American military and intelligence officials it did not identify.

Abbas confirmed that Stephen Kappes, the CIA's deputy director, had accompanied Admiral Mike Mullen, the chairman of the Joint Chiefs of Staff, in his meetings with Pakistani generals.

Abbas said he did not know if the CIA official had presented any information relating to alleged links between the ISI and militants.

However, he said such suspicions were "unfounded and baseless.''

"ISI has contributed the maximum in fighting the war on terror for the coalition, particularly for the United States,'' Abbas said.

U.S. State Department spokesman Sean McCormack on Wednesday declined to comment specifically on the New York Times story. But he told reporters that Pakistan realizes that confronting terrorists along the Pakistani-Afghan border is "a common fight and a common threat.''

McCormack said that "every indication'' shows that the new Pakistani government "understands that and is committed to that fight. Is there a need to do more? Yeah, there's a need to do more.''