BARACK OBAMA may recall a tricky moment when he first met King Abdullah of Saudi Arabia five years ago. Bending to shake hands with the octogenarian monarch, the taller American appeared to bow deeply. Republican snipers in America gleefully blasted the president for “kowtowing” to rich Arabs. Such protocols should run more smoothly when Mr Obama heads to Saudi Arabia on March 28th for his second time in office. Unfortunately, however, relations between the two countries have seldom been more awkward.

Their close alliance dates to the end of the second world war, when an ailing Franklin Roosevelt met Saudi Arabia’s founding king, Abdul Aziz, aboard the cruiser Quincy in the Suez Canal. Then, and for decades after, the equation was simple: America would provide security, the Saudis oil. Those shared interests, cemented by a mutual loathing of communism (and a more recently shared hatred of Iran’s Shia theocracy and of al-Qaeda terrorists), papered over inevitable differences between a hermetic autocracy, backed by fearsomely puritanical Wahhabist clerics, and an ebullient, proselytising democracy.

Such differences have inexorably widened since the end of the cold war, a process that has accelerated since Mr Obama took office. The reasons are not hard to find. For a start, surging oil production at home has sharply lessened America’s dependence on Saudi oil, even as Mr Obama’s determination to extract American forces from such quagmires as Iraq and Afghanistan has been reducing the American bootprint in the region.

At the same time America’s pursuit, with its European allies, of a nuclear deal with Iran has exposed underlying differences. America sees the problem primarily as one of nuclear proliferation and secondarily as a threat to Israel. The Saudis instead fear Iran as a subversive regional rival, geopolitically in unstable countries such as Iraq and Syria, and ideologically as a Shia power challenging the Saudis’ fundamentalist Sunni creed. Despite the slowness of progress in nuclear talks and the legacy of deep mistrust between America and Iran, Saudi officials openly fret that America could “sell them out” for the lure of an historic rapprochement with a power they see as intrinsically hostile.

Other differences, too, are brewing. Unable now to rely so much on American might, the kingdom’s rulers have taken to a more aggressive pursuit of their own regional interests. Widely cheered in the West, the outbreak of the Arab spring in 2011 was viewed with dismay and alarm in the Saudi capital, Riyadh. With scarcely a nod to the White House, Saudi troops intervened in the neighbouring statelet of Bahrain to rescue its king from a pro-democracy uprising by his majority-Shia subjects. While America welcomed the election of the Muslim Brotherhood’s Muhammad Morsi as president of Egypt as a step towards democracy, the Saudis viewed it as a power grab by an Islamist cult, financed by another impertinent neighbour, Qatar, whose noisy Al Jazeera satellite TV channel has long disturbed the royal Saudis’ sleep. In recent weeks Saudi Arabia has dismayed America, which has long urged greater co-operation between Iran’s Arab neighbours, by pulling its ambassador out of Qatar.

The Saudi rulers see the Brotherhood, with its cells inside the kingdom itself and powerful fellow-travellers in countries such as Turkey and Tunisia, as a threat from within Sunni Islam. Small wonder that they have strongly backed its foes, from the Egyptian generals who overthrew Mr Morsi last year, to Syrian rebel factions that have quietly sidelined the once dominant Brothers from Syria’s exiled opposition. Bruce Riedel, an American counter-terror expert, quotes Saudi officials as saying that the kingdom spent $25 billion subsidising such allies as Jordan, Pakistan and Bahrain in 2012, and expects to spend more, now that Egypt has become a prime recipient of such largesse.

Much of this aid does not necessarily flout America’s wishes but, even where interests coincide, friction can arise. Such as in Syria, where joint Saudi-CIA plans to supply anti-government rebels have consistently stumbled against what Saudi operatives view as quibbling American qualms. The halting nature of such supplies, the Saudis complain, has emboldened Islamist extremists who have more regular sources of funding and weapons and weakened the American-backed political opposition. Last August, when Syria’s president, Bashar Assad, was caught red-handed gassing his own people in their hundreds, the Saudis saw a golden opportunity to strike hard. Mr Obama instead shrank back, apparently satisfied with the narrower aim of eliminating Mr Assad’s chemical weapons.

Despite this growing list of grievances on both sides, the two countries need each other. America retains a strong military presence in the Gulf, and cannot be replaced as the ultimate guarantor of Saudi security in the foreseeable future. In the midst of turmoil across the region, and with the threat of jihadist terrorism ever-present, America still relies heavily on the Saudis as the leading local policeman.

And the countries have other things in common, not all of them helpful. Decision-making in both Riyadh and Washington has grown increasingly erratic, even dysfunctional, albeit for different reasons. Saudi Arabia’s senior rulers are old and weary, and prone to factional rivalry as younger princes jostle for power in the inevitable succession to the king, who is thought to be at least 89. Mr Obama’s administration, meanwhile, has been shackled by an unusually obstreperous legislature. He will not even be greeted in Riyadh by an American ambassador. He nominated one in November, but Congress has refused so far to confirm his appointment.