Next year will be the 50th anniversary of Pakistan's first fully fledged military coup. In 1958, it fell to General Mohammad Ayub Khan to “save the nation” from what he called “discredited politicians”, and later to offer himself up for election to consolidate his power. Today's general is a different one, but the justification for continued martial law sounds depressingly familiar.

Such governance may be undemocratic, but both science and education tend to receive more investment when the generals — backed by generous aid from the United States — are in power than when a elected party is in control. It is no accident that many of the country's scientifically most productive institutions were established during the US-backed army rule of General Ayub Khan, again under Zia ul-Haq's rule in the 1980s and now under Pervez Musharraf.

Elected governments led by both Benazir Bhutto and Nawaz Sharif placed science among their lowest priorities. That reflected mistaken thinking that science is an unnecessary luxury in so poor a country, as well as the tendency of these rulers to fill science and education posts with friends in need of patronage. But it is widely accepted that science should have an important role in countries such as Pakistan, helping to develop a skilled population, build robust institutions and assist rational policy-making.

Washington's relationship with Pakistan has been dictated mostly by US priorities in foreign policy. Today, Musharraf is favoured because of his opposition to the Taliban and al-Qaeda. Back in the 1980s, Pakistan under military rule was rewarded by the Reagan administration for taking a frontline role in the war against the Soviet-backed takeover of Afghanistan.

Although Pakistan has pressed ahead with its nuclear-weapons programme, the country's administrations have proved reluctant to spend much of their own money on non-military research, relying instead on US largesse. But this creates problems, as one former minister of agriculture puts it: “When the Americans need us, they shower us with riches. We spend like there is no tomorrow. When they leave, we are unable to maintain our new scientific palaces, and our institutions begin to crumble.”

And so, with yet another US-backed Pakistani military ruler in trouble, will history repeat itself? General Musharraf has shown that he is a ruthless military dictator. In the past four weeks, he has shut down the country's independent media, locked up thousands of his political opponents and sacked an increasingly independent-minded judiciary.

Pakistan has proved reluctant to spend much of its own money on non-military research.

But there is another side to the eight years of his rule. In that time, some 2,000 students have been sent abroad for PhD training; there has been a 60-fold increase in the science budget. Pakistan has 12 million Internet users, and mobile phones are in the hands of 65 million people. And a large university building programme is under way. Some of this is down to Atta-ur-Rahman, Musharraf's right-hand man and head of the country's Higher Education Commission.

Yet, if the past is to be our guide, then entities that will see their budgets cut after elections on 8 January could include the university expansion scheme and the science ministry. The money set aside for maintaining information, computer and telecommunications infrastructure might also be redeployed. An innovative scheme to invite foreign faculty members to Pakistan might be in trouble. And some of the students sent abroad for PhDs will be reluctant to return home if the research environment reverts to what it used to be.

There are, of course, many important differences between today's Pakistan and the military dictatorships of old: for the moment, General Musharraf, who was expected to step down as head of the army this week, may remain a player in any future political scenario. If this happens, Rahman is likely to stay in his job and continue with the reforms. And Musharraf has appointed the highly regarded Shams Kassim Lakha, former president of the Aga Khan University in Karachi, to head the Ministry of Science and Technology.

But Musharraf's survival in any position of power is by no means assured. There is talk of his removal by the army in a counter-coup. There have also been several attempts on his life. None of his military-president predecessors had any lasting democratic role.

The bottom line is that both Pakistan's incoming rulers and their foreign supporters want a stable and secure Pakistan. Many of the existing reforms to science and higher education are crucial to both these aims. If these reforms were allowed to stagnate or die, no one's interests will served, least of all those of Pakistan.