PAKISTAN'S testing of nuclear weapons was inevitable once India gatecrashed the world's atomic club. But ironically, by going public on the fact that both states have warheads and the means to deliver them at long range, the risk of all-out war on the sub-continent may actually have been reduced.

Barring accident, miscalculation or the act of a crazed fundamentalist regime, the nuclear stand-off could well be the best guarantee that Islamabad and Delhi will settle their differences over a negotiating table rather than on a radioactive battlefield.

The belligerent statements issued by the respective capitals in the last few days are for public consumption only, aimed at raising morale and boosting political support for the ruling parties. Both sides know that there can be no winners in a nuclear exchange.

The real danger lies in an uncertain regional future. Many in the Muslim world will see Pakistan's new firepower as ''Islam's bomb''. And despite assurances that none of the bomb-making technology will be exported, the West's fears must centre on the possibility that a reasonably well-balanced government could be toppled and replaced by militants showing less restraint about sharing the know-how.

India has had the ability to build such weapons for at least a decade. Pakistan's blueprint for its warhead design is Chinese.

Chinese involvement is easily explained. Pakistan is a useful counter-balance to India, which fought a brief and humiliating war with China along the two nations' Himalayan frontier in 1962.

The spur for India's quest for nuclear weapons is also obvious. The predominantly Hindu state is all but surrounded by Muslim countries which range from the actively hostile to the merely antagonistic. India thus feels isolated and threatened. Thermonuclear-tipped missiles are there to restore confidence and provide a feelgood factor for the electorate.

America has been a sometime ally of Islamabad, using the country as a springboard for its proxy war with the Soviet Union in Afghanistan, and providing cash and military aid to challenge Chinese influence. But it has not lived up to many of its promises, particularly over the future of the disputed Kashmir province, where a Muslim majority is ruled by a Hindu minority and a simmering guerrilla war has killed 20,000 in the last 10 years.

US policy in Afghanistan also proved to be double-edged. Supplying the mujahideen guerrillas with weapons ultimately succeeded in forcing a Soviet withdrawal, but left the Pakistan border towns infested with some of the most dangerous Islamic fanatics in the world.

There are camps peopled by Egyptian guerrillas belonging to Al Gamaa al-Islamiya, the fundamentalist group responsible for murdering foreign tourists in their own country, and terrorist refugees from Libya, Iran, and Saudi Arabia. Pakistan cannot control them, and has been forced to allow them to export violence in return for sanctuary.

Recently, there have been disturbing signs that the former mujahideen are turning their attention to Pakistan's internal politics. They are a force waiting for control. If that control comes from Iran or Iraq, they could pose a direct threat to both the Islamabad government and to the security of its nuclear arsenal.

Another shadowy player in the new chapter of the Great Game is Israel, backing India in its own weapons' programme to offset the threat of the spread of a nuclear-armed Islam. Intelligence sources claim that Israel's Mossad organisation may have provided security for the Indian nuclear tests.

More alarmingly, Israel's military is also believed to be providing its expertise for Indian contingency plans for pre-emptive strikes against Pakistan's nuclear sites.

Pakistan must now, inevitably, become the focus for the fundamentalist quest for off-the-shelf nuclear hardware. As long as the regime in Islamabad remains stable and can be bribed or browbeaten into maintaining its independence from the lunatic fringe, that will not be a problem. If, however, Iran, Iraq or Libya can generate an Islamic revolution, then all bets are off and the world will become a much more dangerous place.