Musharraf, 58, stands squarely on the side of secularism. And his tilt toward the United States seemed to pay at least one early dividend: the Bush administration said last week it would waive economic sanctions imposed on Pakistan and India after they tested nuclear weapons three years ago. In Pakistan’s long battle between religious extremism and modern secularism, Musharraf had staked out his ground, and it wasn’t in the middle–he was a modern man. But now, with war looming, he may face a backlash in his own land.

The military was thrust into the struggle after an unpopular general, Zia ul-Haq, seized power in 1977. “General Zia made a conscious effort to Islamize the pillars of society and the Army, too,” says Gen. Talat Massoud, who was his Defense minister. “He wanted to draw legitimacy from the process of Islamization.” Among Army officers, promotions went only to practicing Muslims. “We soon realized it was a mistake,” says Gen. Aslam Beg, a former Army chief of staff. But a generation of fundamentalist officers had jumped up the ranks. By now, experts estimate that 30 percent of the officers consider themselves fundamentalist Muslims.

The trend has been particularly evident in the powerful Inter-Services Intelligence (ISI) agency, which has played a central role in Afghanistan–first helping the mujahedin fight Soviet invaders in the ’80s, then supporting the Taliban movement. Gen. Hamid Gul, ISI chief during the Soviet war, is now a Muslim revivalist and unabashedly pro-Taliban. His successor at ISI, Gen. Jarvid Nasser, underwent a religious conversion, gave up drinking and womanizing and became the first Pakistani general to sport a long Islamic beard.

Even fundamentalist soldiers don’t necessarily want an Islamic military. “Most of the top officers are pragmatic enough to realize that won’t work here,” says a Western diplomat in Islamabad. But some officers certainly thought it would. In 1995 a general named Zaheer Abbasi plotted a coup. He planned to declare an Islamic republic and install himself as supreme leader. He was arrested and got 14 years in prison instead.

Nationwide, religious political parties have never won more than 6 percent of the vote. But elections often are not the way governments are made in Pakistan. Frequently, they result from mass unrest and military coups. Many Pakistanis worry that Musharraf’s support for the West could lead to a fundamentalist takeover. “The only scenario where that could happen now is a coup within the military,” says Rifaat Hussain, a Musharraf confidant.

Military fundamentalists appear to be under control, at least for the moment, and the current ISI chief is a solid secularist. “The Army is very unified now,” Massoud insists. “But the seeds are there, and they could germinate.” If large-scale rioting were to break out in Pakistan as a result of U.S. strikes against Afghanistan, the Army might start to totter. That conjures up some scary possibilities. For one thing, imagine what bin Laden and his friends could do with Pakistan’s small but lethal arsenal of nuclear weapons.