PAKISTAN has been ruled by soldiers throughout most of its short history as an independent nation. There was warm applause worldwide two years ago when it held genuinely free elections and installed an intrepid young woman, Benazir Bhutto, as its prime minister. Now, with the obvious support of the military, Pakistan's president has unceremoniously dismissed her, dissolved the parliament and called new elections. It's neither a coup nor a return to martial law. But it's an extraordinarily high-handed intervention against a government whose opposition has been unable to defeat it in a conventional vote of no confidence.

In removing the prime minister, president Ghulam Ishaq Khan spoke of corruption and nepotism. No doubt there was some of that, but the real reasons lie deeper. For months there has been increasing ethnic violence throughout the country. Meanwhile the government has been distracted by the very real possibility of war over the province of Kashmir with its much larger neighbor India. Since both countries have nuclear weapons or are very close to having them, it's a good deal more than a local border quarrel.

The Bhutto government, according to its opponents, is inexperienced and has lost control over a turbulent people who are accustomed to a stronger hand maintaining order. There's some truth to that, but it's also true that the opposition has been deliberately fanning the tribal warfare in its campaign to bring the government down.

There's an unhappy resonance between Pakistan's current politics and India's. Both have been under minority governments. Since last year India has been going through one of the rare interludes in which the Congress party is out of office. The present coalition has been showing signs of unsteadiness. The prime minister, V. P. Singh, threatened to resign last month in an ultimate effort to regain control over his quarrelling allies. If civil bloodshed is endemic in Pakistan it is worse by an order of magnitude in India, where separatist terrorism is entrenched in several provinces -- especially in Kashmir.

India is now using its formidable army to try to control armed Moslem militants in Kashmir, and some 800 people have died in the fighting there so far this year. In Moslem Pakistan those deaths set off sympathetic demonstrations that themselves frequently result in more deaths. Kashmir has been an obsession to both Pakistanis and Indians for many years. That obsession, and the repeated failure of attempts at a peaceful resolution, are becoming a threat to democratic government in both countries.