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 army announced an indefinite, round-the-clock curfew throughout the northwestern valley of Swat, a day after militants there abducted at least 25 police and paramilitary troops. Clashes Tuesday also left two troops and two militants dead.

The violence is a setback to efforts by Pakistan's 4-month-old civilian government to curb militant violence through dialogue. International concern is growing that peace deals have given Taliban and Al Qaeda more freedom to operate.

The army said security forces in Swat backed by helicopter gunships and armored vehicles, exchanged fire with militants for several hours on Wednesday morning.

In the main clash, troops fought off militants who attacked a security post in Sar Banda, about 12 miles (20 kilometers) from Mingora, the valley's main town, an army spokesman said.

Maj. Gen. Athar Abbas said 25 militants were killed, including a senior commander, and many more wounded. 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.

He said the militants were fighting in self-defense and blamed the government for "not honoring" a controversial May peace agreement.

He stopped short of saying the agreement was dead.

"If the government doesn't announce a formal end to this deal, neither will we," Khan said. Talks, for the moment, are out of the question, he added.

Bashir Bilour, a senior provincial minister who negotiated the deal, refused to discuss the Swat situation during a news conference in Peshawar.

The 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 cease-fires have freed up militants to mount attacks across the border into Afghanistan.

U.S. President George W. Bush this week praised visiting Pakistani Prime Minister Yousuf Raza Gilani in Washington as a strong ally against terrorism.

But American officials worry that the lack of military pressure on militants inside Pakistan will only allow them to build their strength and give Al Qaeda a chance to plot another 9/11-style strike in the West.

Tehrik-e-Taliban Pakistan, the umbrella organization for the country's main militant groups, threatened Wednesday to mount attacks across Pakistan because of the renewed military action in Swat.

"We will start operations in the entire country, in the entire province ... because we consider this an action against all Taliban," spokesman Maulvi Umar said.

"We will soon take a decision on starting operations against the government," he said.