The anointment of the House of Saud more than three centuries ago came with a pledge to rule in tandem with the austere clerics of Wahhabi Islam whose puritanical theology has provided some of the underpinnings for extremist groups throughout the Middle East.
In Saudi Arabia, that partnership has left the royal family — often free-wheeling and free-spending in its own habits — presiding over a deeply conservative society with one of the worst human rights records on Earth.
Public beheadings routinely follow Friday prayers, drawing large crowds. A Burmese woman convicted of killing her stepdaughter met her fate last week at the hands of a swordsman in the streets of Mecca, screaming her innocence as she was held down by police, according to video distributed by human rights activists.
This month, a Saudi blogger become the subject of an international campaign to save him from a sentence of 10 years in prison and 1,000 lashes spread over 20 weeks — a sentence so severe that doctors recommended that a second round of 50 lashes be postponed Friday because he had not healed from the first.
Wahhabi doctrine is so deeply entrenched in the desert kingdom that few believe that King Salman — an elderly brother of the late King Abdullah who took the throne this week — is likely to make many reforms.
The grand bargain forged in 1774 between Mohammed ibn al Saud, then a minor clan leader, and the cleric Mohammed Abdul Wahhab, provided the ideological justification for uniting the fractious tribes scattered across the Arabian Peninsula under the rule of the House of Saud.
As their empire expanded, so did the influence of the Wahhabi clerical establishment, which seeks to convert Muslims to their "purer" form of Islam, as practiced at the time of the prophet Muhammad's early followers.
Since the 1970s, billions of dollars from the country's rich oil earnings have been spent on spreading Wahhabism around the world.
"The Kingdom of Saudi Arabia was initially a joint venture between a worldly ruler and the leading cleric," said Jane Kinninmont, deputy head of the Middle East and North Africa program at Chatham House, a British-based think tank. "And that has always been the case since then, in that the clerics have been partners to the government and to some extent provided their legitimacy."
Though the relationship isn't codified, it has given the clerics broad power over education, justice, family law and the role of women while leaving the messy business of domestic politics, foreign policy and the military largely to the monarchy.
Yet tension has emerged through the years, especially with the rise of extremist groups such as Al Qaeda and Islamic State, viewed as domestic security threats.
In the last decade, the country's rulers have sought to moderate the sermons of some of the kingdom's most radical preachers. More modern-thinking clerics have been promoted to senior state positions and scholars from other branches of Sunni Islam brought onto the top clerical council.
"The Wahhabis do not have the same grip over power in Saudi Arabia as they used to over the past centuries," said Ammar Ali Hassan, a Cairo-based political analyst. "The power of politics has overtaken the influence of religion on governing the kingdom, and King Abdullah should be the one taking the credit."
King Abdullah encouraged a reevaluation of the status of women and the rights of religious minorities through a series of national dialogues. He took steps to modernize education and aspects of the judicial system. And in 2013, he appointed 30 women to the Shura Council, a consultative body that produces recommendations for the Cabinet.
But the changes were modest. Women are still forbidden from accessing higher education, marrying, obtaining a passport or traveling without the approval of a male guardian. Two women were detained last month for trying to drive a car across the border from the United Arab Emirates.
"It is not enough for women to sit on the Shura Council if they can't even drive themselves to work," Joe Stork, deputy Middle East director at Human Rights Watch, said in a statement Friday.
The spread of the Internet has provided an opening for Saudis to discuss social and political issues. But the government continues to punish those who criticize members of the royal family, senior religious leaders or government policies.
Raif Badawi's jail and flogging sentence was handed down for starting a website, Free Saudi Liberals, accused of publishing an article seen as ridiculing the kingdom's religious police and other "offensive" material.
Two weeks ago, Badawi was taken in handcuffs and shackles to a square outside a mosque in Jidda, his hometown. A crowd gathered as a security officer approached from behind and started to beat Badawi with a large cane, according to an unidentified witness quoted by the London-based rights group Amnesty International.
"The officer beat Raif on his back and legs, counting the lashes until they reached 50," the witness said. "Raif raised his head towards the sky, closing his eyes and arching his back. He was silent, but you could tell from his face and his body that he was in real pain."
The "Arab Spring" uprisings of 2011 were a shock to the royal family, which escalated its crackdown on dissent, Kinninmont said. With the rapidly declining situation on the country's borders with Yemen and Iraq, she said, the new king could decide to fall back on the alliance with the religious leaders, with whom he enjoys close personal ties.
"At the same time, it is going to be a priority for any new king to make sure that Saudi Arabia is seen to be at the forefront of the struggle against terrorism," she said. "So you're likely to see pressure on the clerics to reign in their followers with jihadi sympathies. And what might they get in return? Maybe they'll get somewhat more influence over local society on issues that aren't seen as so relevant for security."
That could bode ill for those seeking greater protections for women, religious minorities and peaceful dissent.
Special correspondent Amro Hassan in Germany contributed to this report