Yesterday's army coup in the Pakistani capital of Islamabad was a serious blow to what have been extensive U.S. efforts in recent years to prop up shaky civilian governments in Pakistan and curb trends of Islamic extremism, corruption and drug-trafficking in the military of this once stalwart Cold War ally.

High-level Pakistani officials and intelligence reports warned the Clinton administration of a rift between the army and the civilian government of Prime Minister Nawaz Sharif in the weeks leading up to the military takeover, senior U.S. officials said yesterday.

In private communications with Islamabad and an unusual public declaration on Sept. 21, administration officials warned the army against attempting to seize power, then breathed a sigh of relief a week later when Sharif appeared to have settled his differences with his army chief of staff, Pervaiz Musharraf. So U.S. officials were more than a little surprised by the news that Sharif had fired Musharraf while the general was traveling in Sri Lanka, triggering an apparent takeover by army forces loyal to their ousted leader.

The United States has long maintained close ties to Pakistan, which served as a staging area for the CIA-backed war to drive Soviet forces from Afghanistan in the latter years of the Cold War. But U.S. officials increasingly regard the country as a locus of instability and regional tension. Pakistan has been wracked by mounting sectarian violence, much of it linked to Islamic extremism, and its military has been tainted by charges of corruption and drug-trafficking.

U.S. officials have urged Sharif -- as they did in the case of his predecessor, Benazir Bhutto -- to distance himself from the elements in the military linked to Islamic extremist movements, including Afghanistan's ruling Taliban movement as well as Saudi militant leader Osama bin Laden.

Musharraf is considered a secular figure with pro-Western leanings -- his son and brother live in the United States -- although U.S. officials acknowledge they have few inklings as to his intentions for governing.

The administration reacted with caution to the reported takeover, calling it a "political crisis" rather than a coup. Yesterday evening, however, State Department spokesman James P. Rubin issued a statement that read in part: "We regret that once again a chain of political events has led to a setback for democracy and the constitution in Pakistan."

He added, "We would want to see the earliest possible restoration of democracy in Pakistan."

The stage for yesterday's coup was in some respects set last summer, when Sharif agreed under intense U.S. pressure to back down from a military confrontation with India in the disputed Himalayan province of Kashmir. Sharif's decision to withdraw Pakistani forces behind the cease-fire line that divides the province caused deep resentment among military officers who saw the Pakistani incursion as a holy crusade.

But U.S. officials also blamed Sharif for provoking what they considered a needless confrontation with the military. Only last year, they noted, Sharif had infuriated the military by firing Musharraf's predecessor. Then, on Sept. 29, he granted Musharraf an additional ceremonial title of military chairman in a move interpreted in Washington as a peacemaking gesture -- only to dump him two weeks later while he was out of town.

"The context is a knock-down, drag-out fight between the prime minister and the chief of the army staff, with both feeling the other was a threat to their longevity and Sharif deciding now was a time to move against him," said an administration official who spoke on condition of anonymity. "As far as we can tell, he miscalculated."

The tensions between Sharaf and his chief of staff were well known in Washington. Last month, Shabaz Sharif, brother of the prime minister, met with senior administration officials here and warned of the pressures building on the government, according to two officials. Administration officials also picked up signs of trouble in discussions here with Bhutto, the former prime minister, and Imran Khan, a former cricket player turned political opposition leader in Pakistan.

On Sept. 21, an administration official took the unusual step of publicly warning against any transfer of power in Pakistan by "extraconstitutional" means.