A homicide bomber blew himself up Sunday in a crowded market in northwestern Pakistan, killing an anti-Taliban mayor who had formed a militia to fight the militants and 11 other people, officials said.

A purported Taliban commander claimed responsibility for the bombing.

The Taliban have carried out a series of attacks in recent weeks aimed at pressuring the government to abandon an offensive launched in mid-October in South Waziristan, the main Taliban and Al Qaeda sanctuary in the country.

The bombing, in the town of Adazai, about 10 miles south of the main northwestern city of Peshawar, killed the town's mayor, Abdul Malik, and 11 other people, including a young girl, said Sahibzada Anis, the top official in Peshawar.

The homicide bomber hit as shoppers thronged a market where goats were being sold to celebrate the upcoming Muslim festival of Eid.

Twenty-five wounded people — several in critical condition — were rushed to a hospital, police officer Abdul Sattar Khan said.

Malik, who had once been a Taliban supporter, later switched sides and formed a local militia to help fight the militants.

"Malik had survived several attacks on his life in the recent past, since he turned against the militants," Anis said. "But today the militants have finally killed him."

"Our local fighters carried out this attack," the purported Taliban commander, who gave only one name, Omar, said by telephone from an undisclosed location. "He had set up a militia. He was supporting killings of our men. He was interfering in our matters." Omar, whose identity could not be confirmed, threatened to kill anyone who tried to create an anti-Taliban militia.

Khan Zamir was buying goats when the explosion ripped through the street.

"That place turned into hell where the dead and injured were lying everywhere, and blood and flesh were spread around," he said, adding that two of his relatives were badly wounded.

"Now we have our blood in this war," he said, vowing revenge against the attackers.

Militants have struck repeatedly in Pakistan in recent weeks, killing more than 300 civilians and soldiers in attacks aimed at weakening the government's resolve to continue the South Waziristan operation.

Pakistani troops have fought gunbattles in and around key Taliban towns in the region for several days. The latest fighting Sunday in the Taliban heartland killed 20 militants and wounded eight soldiers, an army statement said.

The military says hundreds of militants have been killed in the fighting — a claim the Taliban dismisses. The area is sealed, and the figures are impossible to verify.

About 350,000 people have fled the fighting.