ISLAMABAD – The Pakistani army came to the help of a pro-government militia fighting Taliban in a northwestern district on Tuesday as the United States said Pakistan was gaining in its offensive against the militants.

The Pakistani military launched a major offensive in the former tourist valley of Swat and neighboring districts northwest of the capital in late April after Taliban militants took advantage of a peace pact to conquer new ground.

In retaliation, the Taliban have stepped up bomb attacks and are suspected of being behind a suicide blast at a mosque in the Upper Dir region, near Swat, that killed about 40 people on Friday.

Outraged by the attack, villagers formed a militia, known as a lashkar, of about 500 men and began fighting the militants at the weekend in a bid to force them out of their area.

Senior police officer Rahim Gul told Reuters by telephone two army helicopters had attacked militants surrounded by militia fighters in a village.

There must be militant casualties but we don't know at the moment, Gul said, adding more people were joining the militia and it was making advances after heavy clashes.

Paramilitary soldiers had set up mortars on high ground above the village, Gul said later.

Previously, the army had not helped the militiamen because they were locked in close-quarter fighting with the Taliban and the military was worried it might hit them by mistake.

About 25 militants have been killed in the fighting, police and the military said.

The villagers' action is the latest in a series of instances of people turning on the Taliban in recent weeks, underscoring a shift in public opinion away from the hardline Islamists.

The United States, which needs sustained Pakistani action to help defeat al Qaeda and cut off militant support for the Afghan Taliban, has been heartened by the resolve the government and military are showing in the Swat offensive.

Alarmed by the possibility of nuclear-armed Pakistan drifting into chaos, the United States had criticized a February pact with the Taliban in Swat.

REALLY DIFFERENT

U.S. Director of National Intelligence Dennis Blair said in Washington on Monday the Pakistani army was gaining in its offensive because public support for the operation was solidifying.

For the first time, the Pakistan army operations in that part of the world have support of the government and the public. This is really different from the past, when the army went up and there was little backing, Blair told intelligence officials.

The military says troops have cleared most of Swat though soldiers are encountering pockets of resistance.

The army said on Tuesday afternoon 14 militants and one soldier had been killed in Swat in the previous 24 hours.

In all, the army says more than 1,300 militants and 105 soldiers have been killed. There has been no independent confirmation of the figures.

The offensive has forced 2.5 million people from their homes and the government risks seeing public support evaporate if they are not looked after.

U.S. envoy to Afghanistan and Pakistan Richard Holbrooke also said on Monday that Pakistani public opinion was increasingly on the government's side, and renewed calls for other Western countries to provide more aid to help the displaced.

The international community has not responded adequately to their needs so far, Holbrooke said in New York.

The United States has pledged more than $300 million for the crisis, compared with less than $200 million from the rest of the world, he said.

We have called on other countries to join us in this effort. In the end we are going to need several billion dollars for this small part of Pakistan.

Separately, authorities imposed a curfew in the northwestern town of Bannu after members of an ethnic Pashtun tribe failed to hand over the suspected Taliban kidnappers of hundreds of pupils and staff from a military-run school last week.

Residents and intelligence officials said the military might take action against the tribesmen. All of the kidnapped students and staff were eventually rescued or released.

(Editing by Robert Birsel and Jerry Norton)