As Pakistani security forces rounded up hundreds of suspected Islamic militants last week in the wake of the bomb attacks in London, Ibrahim Qazmi, a slightly built 28-year-old cleric with a wispy black beard, leaned on a pillow in his herbal remedy shop in northwest Pakistan and smiled skeptically.
In 2001, shortly after the Sept. 11 attacks, Qazmi and scores of his associates in Sipah-i-Sahaba, or Army of the Prophet's Followers, were arrested in a crackdown announced by Gen. Pervez Musharraf, Pakistan's president, who vowed to crush the network of radical Islamic groups that had flourished in the country for years.
But just 10 days later, Qazmi said, he and the others were released without charges. Although their group was banned for fomenting sectarian violence, they simply changed its name and revived it. Their top leader was elected to the National Assembly, and Qazmi was elected to the legislature of the North-West Frontier Province, now dominated by fundamentalist Islamic parties preparing to establish a morals police force.
"So you see, despite the ban, we have only gotten stronger," Qazmi said with a chuckle.
The story of Qazmi underscores Musharraf's contradictory record as one of the most important allies in President Bush's war on terrorism.
Since 2001, Musharraf's government has arrested or killed more than 700 suspected al Qaeda members. Last week, as Pakistani authorities investigated several radical Islamic groups for possible links to the London bombers, Musharraf told journalists his government had "completely shattered al Qaeda's vertical and horizontal links" within Pakistan.
But when it comes to eliminating homegrown extremist groups, the commitment is less clear.
Since 2003, Musharraf has been allied with a coalition of radical Islamic parties, the Muttahida Majlis-e-Amal (MMA) or United Action Forum, which has helped him cement his power. The government has banned 16 domestic radical groups and arrested thousands of suspected fighters, but most of them were quietly released.
Critics charge that the government has been slow to implement a pledge to review the finances and curriculums of thousands of religious schools, or madrassas. Most have no links to violence, but analysts say that some have served as breeding grounds for Islamic fighters. Two suspects in the July 7 London transit bombings were young men of Pakistani origin who had recently visited Pakistan.
Similarly, although the Pakistani army killed more than 300 militants in a campaign against al Qaeda bases near the Afghan border last year, it has since proved unable or unwilling to stop fighters from the ousted Taliban militia from slipping back into Afghanistan to launch bombings and attacks.
"The crackdown after September 11, 2001, was just window dressing for Western consumption," said Afrasiab Khattak, a human rights activist in the northwestern city of Peshawar. "None of the top Pakistani leaders were arrested."
Although Musharraf defended his anti-terrorism record in a speech last week, he also said that "restraining factors" such as an unstable economy and tension with India over the Himalayan province of Kashmir had limited his ability to go after domestic militants. Now, he said, "we need to act against the bigwigs of all the extremist organizations."
But analysts said Musharraf's resolve would likely continue to be counterbalanced by the same domestic political problems that have bedeviled him in the past.
One is the Pakistani military's reluctance to defang militant organizations that were sponsored by government intelligence agencies in the 1980s as proxy fighters against Indian troops in Kashmir. Since then, many Kashmiri groups have linked up with members of al Qaeda to attack Western targets.
One such group, Lashkar-e-Taiba, is affiliated with a madrassa where one of the suspected London bombers, Shehzad Tanweer, may have studied for several months, according to news accounts. Another group, Jaish-e-Mohammed, has been blamed for two assassination attempts against Musharraf.
"These groups have all increasingly morphed together," Peter Bergen, a Washington-based expert on Islamic terrorism, said in a telephone interview. "It's like a pickup basketball game where anybody who is available for a particular operation will do it."
But a Pakistani intelligence official said many military and political leaders believe the Kashmiri militant groups are still a vital lever against India. The idea of Pakistani authorities "nabbing the people who challenged the Indian army in Kashmir . . . sounds scary to all decision-makers," the official said.
Thus, even after the government banned Lashkar-e-Taiba, its leader continued to preach openly and attend rallies in Islamabad, the capital. A recent Pakistani press report described a training camp for Kashmiri militants just 60 miles from Islamabad. If Musharraf tried to move against such camps, observers said, he could be undermined by religious conservatives inside the military.
"Even if I were to give him the benefit of the doubt, I don't think he has the structures in place to implement such policies," said Sen. Raza Rabbani, a leader of the moderate Pakistan People's Party.
Musharraf must also contend with scattered public support for Taliban insurgents fighting in Afghanistan, as well as resentment toward the United States fueled by its policies in Iraq and elsewhere in the Middle East.
On a recent afternoon, worshipers streaming out of a mosque in the northern city of Peshawar expressed strong sympathy for Taliban fighters. One, Jamil Khan, a postal worker, said the United States "just wants to spread Christianity" in Afghanistan. "Pakistan should be helping the Taliban," he added. "Musharraf is just an agent for America."
Such sentiments helped the MMA, the coalition of Islamic parties, win 20 percent of seats in the 2002 National Assembly elections, as well as a controlling majority in the North-West Frontier assembly. Although this was a setback for Musharraf's moderate policies, the need for legitimacy drove both sides to form an alliance in 2003.
The MMA agreed to help pass a constitutional amendment that would allow Musharraf to remain both president and head of the military; in exchange, Musharraf agreed to recognize the MMA as the official opposition in parliament. Now, religious figures who once trained Taliban adepts in their madrassas have become powerful politicians.
"The people who created the Taliban are now effectively running half of Pakistan," said Samina Ahmed, an Islamabad representative from the International Crisis Group, a research organization based in Brussels.
Many Pakistanis worry that the MMA is trying to re-create Taliban rule. In June, the North-West Frontier assembly passed a law allowing religious ombudsmen to fine or jail people for conducting "entertainment shows" near mosques and "indecent behavior at public places."
Qazi Hussein Ahmed, who heads the dominant party in the MMA coalition, said that his group had criticized some extreme Taliban practices and that terrorist attacks on innocent civilians were prohibited by Islam. But he also said Kashmiri militants were justified in their "holy war" against India, and he implied the same of Taliban insurgents fighting the U.S.-backed government in Afghanistan.
"Afghanistan is an occupied country," Ahmed said. If there is no peaceful way to remove foreign troops, "it's inevitable that violent approaches will be adopted. I won't say this is compatible or incompatible with Islam."
Aides to Musharraf said his relationship with the MMA had recently grown strained. The government has appealed to Pakistan's Supreme Court to overturn the religious ombudsman bill, and the MMA has protested the arrests of suspected militants. But to Islamic radicals like Qazmi, the future still looks solid.
"It will be difficult for the government to really ban us," he said confidently, sitting in a shop crammed with religious texts and tapes. Musharraf, he said with disdain, is a "tool in the hands of Western forces" but still incapable of stopping the radical Islamic movement at home. "If we wanted to, we could bring life in Pakistan to a standstill and take control."
Special correspondent Kamran Khan in Karachi contributed to this report.