THESE are not easy times for Saudi Arabia. It is engaged in a fight for supremacy in the global oil market against America’s shale-oil upstarts. It frets that America will strike a nuclear deal with Iran and move closer to the Shia power with which it vies for influence in the region. It has tried and failed to oust Syria’s leader, Bashar Assad, strengthening both his Iranian ally and creating a virulent new strain of Sunni jihadism. It is taking part in America’s air campaign against the jihadists, but at home there are rising fears of a terrorist blowback, of the sort that Riyadh suffered at the hands of al-Qaeda between 2003 and 2005. Indeed, on January 4th a suicide-bomber killed a Saudi general and two other soldiers on the border with Iraq, despite Saudi efforts to fortify and extend a buffer zone. The border with Yemen is scarcely safer.

Little wonder, then, that Saudis have been rattled by the news that King Abdullah, their 90-year-old monarch, was taken to hospital on December 31st with breathing difficulties, which Saudi officials said was pneumonia. The hospitalisation sparked particular concern because the king tends to be treated in medical facilities in his palaces. By January 7th local rumour had it that he was able to meet visitors. It is no secret, however, that the monarch will not be around for much longer. The man designated to take over is his half-brother, Prince Salman. But the prince is no spring chicken either; he is 78 years old and said to be suffering from dementia.

Under Saudi Arabia’s’ complicated system, power is not passed by primogeniture. Rather, it has been handed from brother to brother among the 45-odd sons (borne by many women) of Abdel Aziz bin Saud, who founded the state and dynasty in 1932. These days all the siblings are either dead or old (see chart).

Perhaps with Salman’s frailty in mind, in March last year King Abdullah took the additional step of appointing a deputy heir—his youngest brother Muqrin, a British-trained air force pilot, former intelligence chief and ex-governor of Medina, aged 69. “The succession has always been orderly and the next batsman is clearly Salman,” says Khaled al-Maeena, a veteran Saudi journalist. “But anything could happen after that.”

The difficult task will be to pass rule onto the next generation, where hundreds of princes are jostling for power. These include Muhammad bin Nayef, the interior minister and a member of the powerful Sudairi line. But King Abdullah seems to be trying to position his own sons, Miteb, who heads the national guard, and Mishaal, who is governor of Mecca.

A future Saudi monarch may find foreign policy the easy part of the job. At home problems are pressing and less attended to. Liberals rail against the slow pace of reform in a country where the Koran is the constitution and women are still banned from driving, while the devout Wahhabist religious establishment balks at innovations such as the appointment in 2013 of 30 women to the Shura Council, a consultative body. The Shia population in the country’s east, who make up some 15% of Saudis, are restless.

Above all, the youthful and growing population of 30m needs jobs. This means reducing subsidies and handouts, and weaning the economy off its dependence on oil. Abdullah has been seen by most Saudis as a benevolent father-figure. His successors may not be so fortunate.