For a country that has been deeply implicated in the creation of such extreme Islamist groups as the Taliban, al-Qaeda and even Islamic State, Saudi Arabia does not always appear as a natural ally of the West.
Only last week, as King Abdullah lay on his deathbed, the kingdom provoked an outcry over the brutal sentence meted out to Raif Badawi, a blogger whose crime amounted to little more than posting mild criticisms of a few senior clerics. In Saudi Arabia, where the mutawa, or religious police, is more powerful than the state security forces, any criticism of the religious establishment is likely to provoke a harsh response.
Having initially been charged with apostasy, which in Saudi Arabia carries the death penalty, Badawi was eventually convicted on the lesser charge of insulting Islam, and sentenced to 10 years in prison and 1,000 lashes, the latter to be carried out in individual sessions of 50 lashes each week until the full sentence was complete.
In the event, King Abdullah was obliged to intervene when Badawi was taken to hospital after receiving the first batch of lashes in front of hundreds of spectators outside the al-Jafali mosque in the port city of Jeddah earlier this month. Concerned that the case was damaging the kingdom's relations with the outside world, the ailing king ordered it to be referred back to the supreme court, thereby avoiding the immediate prospect of Badawi being subjected to further acts of state-sponsored cruelty.
Abdullah's intervention, one of his final acts before finally succumbing to pneumonia on Friday morning, illustrates the difficult balancing act the Saudi royal family needs to undertake if it is to succeed in satisfying the competing, and often contradictory, demands of the country's conservative Muslim population and its Western backers.
At the heart of this dichotomy lie the twin objectives that have dominated Saudi policy for decades: namely, the need to protect the pre-eminence of the House of Saud as the country's undisputed masters, and the desire to maintain Saudi supremacy over its arch regional rival, Iran.
Ever since the Al Saud dynasty seized control of the desert kingdom in the aftermath of World War I, it has needed to reach an accommodation at home with the powerful Wahhabi sect, widely regarded as the most puritanical in Sunni Islam. In doing so, the Saudi authorities have turned a blind eye when followers of the Wahhabi creed have sought to fund radical madrassas abroad - notably in Pakistan. But these have spawned a generation of Taliban militants, as well as providing funding to extreme Islamist groups, such as al-Qaeda and Isil.
Wahhabi power also explains why the Saudi royal family continues to tolerate the medieval punishments routinely carried out after Friday prayers, with common criminals routinely beheaded.
It is only when, as happened with the September 11 attacks in 2001, these policies rebound on Riyadh's relations with the outside world that the Saudis are obliged to intervene. After 15 of the 19 hijackers responsible for the atrocity were found to be Saudi citizens, Abdullah personally oversaw a crackdown on radical jihadist literature, ordering that textbooks be purged of their most extreme language and sending 900 imams to re-education classes.
The royal family is now in a similar quandary over Isil. Having quietly allowed a number of private Saudi donors to fund Islamist militant groups seeking to overthrow the regime of the Syrian dictator Bashar al-Assad, the Saudis suddenly found themselves being accused of helping to create an organisation now deemed to pose the greatest threat to Western security. Consequently, the Saudis are in the invidious position of using their military to support the Western-led coalition set up to destroy the very terror organisation - Isil - that many claim the Saudis helped to create in the first place.
As far as Isil is concerned, the reason the Saudis find themselves in this awkward predicament is that their main objective in supporting the rebels was to secure the overthrow of the Assad regime - which just happens to be Iran's closest ally in the region.
Iran, the world's most populous Shia Muslim country, has been at loggerheads with Saudi's Sunni Muslim rulers since the 1979 Iranian revolution, when Ayatollah Khomeini claimed the corrupt Saudi royal family should be stripped of its title as Custodian of the Two Holy Mosques. More recently, tensions between the two countries have intensified over Iran's nuclear programme, with the Saudis warning that, if the ayatollahs achieve their goal of building an atom bomb, they will find themselves at the mercy of their fanatical Shia neighbours.
A strong alliance with the West is therefore deemed vital by the Saudis for keeping the Iranians at bay, and to this end they are prepared to tone down their support for policies that end up causing friction, an approach that is likely to be continued by the country's new monarch, 79-year-old King Salman.
For, so long as the Saudi old guard remains in charge, there are unlikely to be any radical changes in the way the country is governed. For that we will have to wait for a new generation of Saudi princes to take power, one that is not beholden to the archaic system of government laid down by the nation's founding fathers.