When wayward Saudi princes misbehaved, they ended up in Salman’s private jail.

During the 48 years he was governor of Riyadh, from 1963 to 2011, now-King Salman bin Abdul Aziz maintained a small jail on the grounds of his official palace, where he would lock up royals who ran afoul of the law.

“Who else was going to discipline a prince?” said Robert Lacey, a British author who has written extensively about the Saudi royal family. “Salman has great authority within the family. He is beloved and feared. He is a tall, upright son of the desert.”

Serious questions have been raised about the health and ability of Salman, whose rule began upon the death of King Abdullah bin Abdul Aziz. Salman, 79, is widely believed to have significant health problems.

“He can perform quite well for a few minutes, but then he gets muddled and goes off message,” said Simon Henderson, an authority on Saudi Arabia and succession issues at the Washington Institute for Near East Policy.

Relatives and dignitaries paid their respects to before his burial in an unmarked grave Friday. In mosques across the country, worshippers offered prayers for the former ruler who left a mixed legacy. (Reuters)

Accounts of the severity of Salman’s health problems vary. One Western diplomat in Riyadh said that he had spoken to Salman recently and that he seemed engaged in their discussion.

While accounts of royal health issues are often unreliable, questions about Salman’s health hang over his rule at a time when Saudi Arabia is facing daunting challenges, including sharply reduced oil prices, rising Islamic State violence just across its border with Iraq, upheaval in Yemen on its southern border and an aggressively assertive government in Iran, its main rival for regional power.

Many analysts are looking beyond what could potentially be a short reign to Salman’s brother and designated successor, Crown Prince Muqrin, and then beyond Muqrin to the newly appointed deputy crown prince, Mohammed bin Nayef, who would be the first ruler to come from the next generation of Saudi princes.

Before his health problems, analysts agree that Salman was a formidable and admired leader for decades.

“He was known as an arbitrator in royal family disputes, usually between the liberal wings and the conservative wings of the family,” said Nasim Chowdhury, a business consultant who lives in Mecca. “He’s one of the most popular members of the royal family; people can identify with him.”

Salman became almost synonymous with the city of Riyadh, which was little more than a desert backwater when he first arrived as deputy mayor in 1954. He oversaw its transformation into a vibrant metropolis filled with luxury hotels, banks, shopping malls and a wide array of international-brand shops.

“He really made a marvelous job of creating Riyadh as a Saudi center of power and a city that works pretty well,” Lacey said. “He is a phenomenal worker. People used to set their clocks right at 8 every morning when his cavalcade of cars would go by on the way to the office.”

Salman’s authority within the royal family also comes partly from being one of the “Sudairi Seven,” an exceptionally prestigious and influential wing of the royal family.

The seven were all full brothers who were sons of national founder, King Abdul Aziz ibn Saud, and Hassa al-Sudairi, a woman from a powerful family in the central Najd region, where Riyadh is located.

When Abdul Aziz was taking control of what would become Saudi Arabia, he married into important clans to solidify his power.

The seven have included two kings — Salman and his brother King Fahd, who died in 2005 — and two crown princes, Sultan and Nayef, who died before becoming king.

Several of Salman’s sons have also been successful, including Faisal, the governor of Medina province; Abdulaziz, the deputy oil minister; and Sultan, who became the first royal and the first Arab in space when he flew aboard the space shuttle Discovery in 1985.

Salman had two other sons die of heart ailments within a year of each other in 2001 and 2002, which Lacey said “hit him very sadly” and had a lasting effect. Salman also has had back problems, for which he had surgery in the United States in 2010.

In 2011, Salman was appointed defense minister. Henderson said that his record there was unremarkable, largely because of his deteriorating health. Salman has also been involved in private business, controlling the Saudi Research and Marketing Group, which publishes several influential newspapers. A son, Turki, runs his publishing enterprises for him.

Analysts said they expected Salman, considered a moderate in the mold of Abdullah, ­to generally continue the policies ­of his predecessor, who was kn­own as a modernizer but also oversaw a regime that was widely criticized for its human rights ­­record.

In the past two years, the Saudi government has cracked down hard on dissent, jailing human rights lawyers and activists, sometime for simply tweeting criticism of the country’s political or religious leaders.

The Saudi government has earned international scorn for publicly flogging Raif Badawi, a rights activist in the southern port city of Jiddah. After the international criticism, Abdullah took the unusual step of referring Badawi’s case to the Supreme Court for review.

Lacey said Salman is also known as a sort of unofficial historian of the royal family.

“He’s a very central figure in the family,” Lacey said. “I’ve had many people tell me that he was the one who most resembled his father, in terms of looks and stature. When he goes, there will never be anybody else in the family like him.”

Correction: This article has been amended to correct an earlier, unverified characterization of King Salman’s mental health. The article’s assertion that King Salman was “widely believed … to suffer from dementia’’ was too speculative and unsubstantiated to meet The Post’s standards for publication.  The Royal Court of Saudi Arabia, through its lawyers, has asserted to The Post that King Salman is “most certainly not suffering from dementia or any other kind of mental impairment.’’