The military coup in Pakistan is a serious setback for both secular democracy and for stability in the volatile subcontinent, where both Pakistan and its longtime rival India have tested nuclear weapons and missiles in the past 18 months.

Although prompted largely by a personal power struggle between Prime Minister Nawaz Sharif and Gen. Pervaiz Musharraf, the head of the armed forces, the coup could have far-reaching implications. It could increase Pakistani aggression in the disputed Kashmir region, where Pakistan and India fought a 10-week border war this year. It could leave Pakistan's nuclear arsenal in military hands, unfettered by even the pretense of civilian political control. And it could potentially strengthen Islamic fundamentalism in Pakistan, where religious sentiment has been rising within the military.

Indian officials said Tuesday that the coup is a "matter of grave concern," and Indian troops were reportedly placed on alert along the 450-mile border, known as the Line of Control, that divides Kashmir. The new government of Indian Prime Minister Atal Bihari Vajpayee was sworn in this morning and planned to hold an emergency meeting of top security officials immediately afterward.

India, which is largely Hindu, and Pakistan, which is an Islamic state, have fought three full-scale wars in the past five decades. This summer they engaged in a smaller conflict in mountainous Kashmir, which is divided between the two nations.

Vajpayee and Sharif held talks last winter in the Pakistani city of Lahore and pledged to settle their differences peacefully. But the dialogue was undermined by the outbreak of fighting along the border, and Tuesday's military takeover seems likely to deal a further blow to the prospect of resuming negotiations.

In recent weeks, the Pakistani army has been widely reported to be upset with Sharif's decision, at U.S. urging, to pull Pakistan-based fighters back from the border. The army has long viewed Indian Kashmir as a rightful part of Pakistan, and guerrilla groups backed by the Pakistani military have recently stepped up a terrorist campaign there.

The coup, the fourth in Pakistan's turbulent half-century of independence, could also badly damage Pakistan's standing in the West. Pakistan is impoverished, in debt and heavily dependent on the United States for economic survival. Three weeks ago, as tensions were mounting between Sharif and Musharraf, officials in Washington warned that the Clinton administration would "strongly oppose any attempt to change the government through extra-constitutional means."

The United States has been pressing both Pakistan and India to sign a comprehensive nuclear test ban treaty, but both Sharif and Indian officials have resisted. Now, with the treaty in limbo in the Senate, the Pakistani coup could be a setback for the prospect of nuclear disarmament in the region.

"This is a dreadful development," said Praful Bidwai, India's leading anti-nuclear activist. "It should worry everyone that the situation is so volatile. All assumptions about stability, about reasonable forms of military balance, about nuclear deterrence working, are liable to break down."

Some Indian analysts struck a calmer tone. Lt. Gen. V.R. Raghaven, a retired army official, said that Indian governments have "learned to deal with military governments in Pakistan, both in peace and in wartime." But he described the situation as "extremely serious" and said it has "brought great instability to the region."

In recent years, the Pakistani military has been increasingly influenced by Islamic thinking, a legacy of the late dictator Gen. Mohammed Zia ul-Haq, who led a military coup in 1977 and subjected the country to harsh Islamic law until his death in a plane crash in 1988. Some military officials have been working closely with conservative Muslim groups who want to impose Islamic law on the nation.

Musharraf is known as a professional officer, however, and he was handpicked by Sharif only last year after the prime minister fired his predecessor. Even some secular parties that oppose Sharif had been reported to be seeking Musharraf's approval for a move against the prime minister.

Some Pakistani experts speculated on Tuesday that Musharraf might appoint an interim national government, perhaps along the lines of a formula that opposition parties, angry with Sharif's failure to revive Pakistan's ailing economy, have been demanding for months. Two and a half years after Sharif's election on a pledge to restore the country's economic well-being, foreign investment is at a standstill, inflation is rampant, the foreign debt stands at $32 billion and unemployment is at an all-time high.

In an interview last week, Brig. Rashid Qureshi, the spokesman for Pakistan's armed forces, declared that the military had no desire to oust the government, only to help rescue the country from economic collapse. He also said the army was committed to remaining a secular institution, and that it would not tolerate excessive Islamic zeal within the ranks.

"There are no power-hungry generals," Qureshi said. He acknowledged that there was "disgruntlement and dissatisfaction" in the army over the pullback from Kargil, the remote Kashmir border region that was the setting for the recent conflict, but he added that "the only way Pakistan can survive and progress is if all elements of power are one in thought and action. The army is a stabilizing influence, and there is a collective feeling that we must help."

According to some analysts, Sharif may have abetted his own downfall by systematically cutting off all avenues of institutional dissent since he took office in early 1997. In recent months, he has emasculated the presidency and the Supreme Court, muffled dissenters in parliament, arrested opposition activists who tried to hold demonstrations and hounded the press.

"By eliminating all constitutional avenues to his leaving power, Nawaz has brought us back to 1977, when Gen. Zia seized power," said Tariq Naheen, a former government minister and lawyer in Lahore.

CAPTION: Demonstrators celebrate the coup against democratically elected Prime Minister Nawaz Sharif as troops enter television station.