Police have arrested 39 suspected Taliban fighters hiding among refugees from a military offensive against militants from Pakistan's Swat Valley region, a senior officer said Friday.

The arrests, made in the past few days, were the first of alleged militants among more than 2 million people who have fled the fighting.

The military says it has killed more than 1,100 militants in a month of heavy clashes and has the Taliban on the run. The offensive is strongly backed by Washington and viewed as a test of the Pakistani government's resolve to quell Islamic extremism.

Officials had previously warned that fleeing insurgents may try to take refuge among civilians.

One dozen of the suspected Taliban were arrested in refugee camps south of the Swat region, while the others were picked up in houses where refugees were staying with relatives or were renting, said Syed Akhtar Ali Shah, the police chief in Mardan, a town that hosts some of the roughly one dozen camps.

"These Taliban have mixed up themselves among the refugees," Shah told The Associated Press by telephone.

They had cut their hair short and shaved their beards in a bid to disguise themselves from authorities and blend in with civilians, he said. Many conservative Muslims believe men should grow their hair and beards long as a sign of piety.

Shah accused the men of violence in Swat and nearby Buner. The Taliban's advance into Buner from Swat last month triggered the military's offensive.

The Taliban struck back in an attack Wednesday on the headquarters of Pakistan's top intelligence agency and a police center in the eastern city of Lahore, killing 30. Officials said three bomb attacks within hours of each other Thursday that killed 14 people in the northwestern cities of Peshawar and Dera Ismail Khan were also Taliban revenge attacks.

Authorities tightened security in Pakistan's major cities Friday, a day after Taliban leader Hakimullah Mehsud warned of more reprisal attacks. In Peshawar, local officials banned the carrying of guns in public, gatherings of more than five people and vehicles with tinted windows.

President Asif Ali Zardari visited a refugee camp in Swabi, another northwestern district, where he handed out cooking equipment and other aid supplies.

"I understand that you are away from your homes. You feel homesick and you also have pain for those you have lost," Zardari said. "God willing, the days are not far away when you will get back home. The whole of Pakistan is with you."