THE fate of the Arab world's two most important states lies in the hands of ageing autocrats. Hosni Mubarak, an 82-year-old air-force general who has ruled Egypt since 1981, is widely reported to be grievously ill. King Abdullah of Saudi Arabia, who assumed the throne of the Arabs' richest country five years ago but has run the show for longer, is reckoned to be 86. The grim reaper will bring change in both places soon.

Maybe the old men will manage to control their succession. President Mubarak has been preparing the ground for his son, Gamal, to take over (see special report). King Abdullah's anointed successor, Crown Prince Sultan, one of his 18 surviving brothers, has long been poorly, but there are plenty more where he came from (see article). Decades of repression have ensured that the opposition is quiescent in Egypt and virtually inaudible in Saudi Arabia. But they have also made these countries vulnerable to violent disruption. Transition in autocracies often means instability.

The fate of these two countries matters to the West for two big reasons: energy and security. Egypt and Saudi Arabia have been reliable, if flawed, allies. Should they stumble, the West's interests in the region will be imperilled. That is why those regimes need to be encouraged to liberalise their countries' economic and political systems further and turn them into places where change brings hope not fear.

What's wrong with them…

The problem of Arab governance is by no means confined to those big two. In the past few centuries the Arabs, once pre-eminent in a host of skills, from astronomy and algebra to architecture and engineering, have seen their societies stagnate and fester. Though blessed with natural resources, especially the oil that has enriched Arab dynasties and their subservient elites while often leaving the masses in penury, few Arab countries have seen their non-oil economies flourish or their people enjoy the public services or freedoms taken for granted elsewhere.

Of the Arab League's 22 members, not a single one is a stable and fully fledged democracy. Fragile but sophisticated Lebanon may come nearest, despite its lethal rivalries between sect and clan and failure to get a single national army to control all its territory (see article). Post-Saddam Iraq has had genuine multiparty elections but is mired in corruption, violence and sectarian strife. The Palestinians had a fair election in 2006 but the winners, the Islamists of Hamas, were not allowed to govern. A handful of other countries, such as Morocco and Kuwait, have multiparty systems, but monarchs still rule the roost. And where they have given way to republicans, new dynasties, such as Syria's today and Libya's probably tomorrow, still hold sway. Even sub-Saharan Africa has a better record of electoral freedom.

The rulers of Egypt and Saudi Arabia, ancient as they are, have made improvements. Egypt's economy has belatedly begun to grow quite fast. The Saudi king is educating his people, even women—though he still won't let them drive a car. He has spent more than $12 billion creating just one new university near the Red Sea port of Jeddah, while pouring many more billions into ambitious projects, such as high-speed railways, that should benefit everyone. But the closed political systems of Egypt and Saudi Arabia, the uncertainties of dynastic power-mongering and the corruption inherent in patronage-ridden autocracies still often leads to plotting at the top and frustration that could spill over into anger at the bottom. That becomes more likely as the internet, mobile phones and easier travel make people far less easy to control.

It would be naive to urge or expect either country to become a full-blooded democracy in a trice. Each could descend into chaos, winding up with a fundamentalist version of Islamist rule that would make the present regimes look cuddly by comparison. Many Egyptians, including reform-minded professionals, fear that the Islamists of the Muslim Brotherhood, the unofficial opposition, would never relinquish power once they had won it at the ballot box. Sensible Saudis know that those who sympathise with their compatriot Osama bin Laden would impose an incomparably nastier regime than the present one, if given the freedom to do so.

All the same, the suppression of Egypt's Muslim Brothers, who have a large following, has been unwise as well as unjust. Thousands of them are in jail; many have been tortured. Leading Brothers repeatedly disavow violence and jihad, insisting that they, like Turkey's mild Islamists, would hold multiparty elections if they ever won power—and would graciously bow out if the voters told them to. Mr Mubarak must seek to draw the Brothers openly into the parliamentary and perhaps even ministerial fold, and test their sincerity, at first by giving them a chance to run local councils. And in the presidential election due next year, all the obstacles that make it nigh-impossible for a relative outsider, such as Mohamed ElBaradei, a former head of the UN's nuclear watchdog, to compete, should be swept away. As for the Saudis, their king should at least encourage his Allegiance Commission, an inner family body of some 35 princes that is meant to oversee the succession, to skip a generation rather than plod down the geriatric line of the surviving sons of the founding king.

…and what's to be done

Elections, though vital in the end, are not an early panacea. What the Arabs need most, in a hurry, is the rule of law, independent courts, freeish media, women's and workers' rights, a market that is not confined to the ruler's friends, and a professional civil service and education system that are not in hock to the government, whether under a king or a republic. In other words, they need to nurture civil society and robust institutions. The first task of a new Saudi king should be to enact a proper criminal code.

In the Arab lexicon, the concept of justice means more than democracy. In the end, you cannot have the first without the second. But the systems that now prevail in the Arab world provide for neither.