Gunshots pierced the air as Pakistani troops battled Taliban extremists in the Swat Valley's main city, a trapped civilian said, while helicopter gunships pounded alleged militant hide-outs in a nearby tribal region Sunday, killing at least 18 people.

Elsewhere in the northwest, police said they had captured an important militant commander and six other Taliban fighters.

Al Qaeda and Taliban fighters have long had hide-outs in Pakistan's northwest. The U.S. has pushed Pakistan to use force to root out the insurgents, who are often involved in attacks on U.S. troops across the border in Afghanistan.

The operation in Swat has strong support from Washington, and retaking Mingora city, Swat's main commercial hub, is key. The army says 10,000 to 20,000 residents are still stranded in the town, which normally has a population of at least 375,000.

"I will try to leave again whenever I get another chance," Fazal Wadood, 45, a local political party leader, told The Associated Press by telephone Saturday night. "It is like inviting death to stay here anymore."

Officials have downplayed reports that the army would expand the offensive to the lawless, semiautonomous tribal regions bordering Afghanistan. However, violence has continued to flare in those areas.

On Sunday morning in the Orakzai tribal region, helicopter gunships pounded suspected militant targets in multiple locations, including a religious school, local government official Mohammad Yasin said.

At least six civilians were among the 18 dead, he said, adding that the targeted spots were strongholds of Hakeemullah Mehsud, a deputy to Pakistani Taliban chief Baitullah Mehsud. Hundreds fled the area amid the fighting, he said.

Also Sunday, police in nearby Charsadda district said they caught seven Taliban militants during a raid on a religious school. They included Qari Ihsanullah, a Taliban commander suspected in attacks in Pakistan and Afghanistan, Charsadda police Chief Riaz Khan said.

"We recovered three suicide jackets, explosives and assault rifles," he said of the Saturday night raid.

In Swat, the fight for Mingora could prove a stiff test for an army more geared toward conventional war on plains than bloody urban battles. Army spokesman Maj. Gen. Athar Abbas said Saturday that retaking the town was likely to be "painfully slow" because of the civilian presence.

Wadood, a leader of the opposition Pakistan Muslim League-N party, said the gunfire Saturday was at first continuous and then came at intervals. He said he had tried to flee the city twice already but failed due to the fighting and lack of transportation.

Around 3,000 to 4,000 people are still trapped in his neighborhood near the emerald mines on the outskirts of the city, he said.

The military says about 1,100 suspected insurgents have died so far in the monthlong offensive in Swat and neighboring districts. It has not given any tally of civilian deaths, and it's unclear how it is separating regular citizens killed from militants. Residents fleeing the region have reported dozens of ordinary Pakistanis killed in the fight.

Abbas said about 1,500 to 2,000 hard-core insurgent fighters remained in Swat. Information provided by the military and civilians is nearly impossible to verify independently because of limited access to the area.

The offensive has also triggered an exodus of nearly 1.9 million refugees, more than 160,000 to relief camps. Some fear the generally broad public support for the military campaign could drain away if the refugees' plight worsens or if the army gets bogged down too long.