Once it would have been almost unthinkable: a red carpet roll-out in Riyadh for a Russian leader. "Those Godless Communists" is how some of Saudi Arabia's more devout citizens once referred to the Soviets during the Cold War. How the world has changed since then.
This week has seen a full ceremonial 21-gun salute for President Vladimir Putin in the capital, an audience with the king and crown prince, a host of bilateral deals and a seismic strategic recalculation in the region as Saudi Arabia's US allies effectively abandon the Kurds to their fate in northern Syria.
So how close is Saudi Arabia now drawing to Russia and why?
President Putin has made a rare but much-publicised visit to Saudi Arabia - his first in 12 years - accompanied by a sizable delegation of trade, security and defence officials. Bilateral deals worth more than $2bn (£1.6bn) and more than 20 agreements have been announced.
The Saudis have also invited Russia to participate in the ongoing international investigation into the 14 September drone and missile attacks on Saudi oil facilities.
Defence discussions have included the possible purchase and future deployment of Russia's formidable S-400 air defence missile system, which would be something of a diplomatic blow to Washington.
The US recently cancelled Turkey's participation in its F35 fighter programme after Turkey went ahead with buying the S-400 from Russia.
Bilateral trade deals between Riyadh and Moscow have been accelerating since a June 2018 agreement and recent co-operation to restrain global oil supplies to keep prices buoyant.
Announcements by RDIF, Russia's Direct Investment Fund, to coincide with President Putin's visit include:
- A deal with Saudi state oil company Saudi Aramco to acquire a 30% Saudi share in Novomet, a Russian oil equipment supplier
- A $600m deal for Saudi Arabia to invest in Russian aircraft leasing business
- Possible co-operation between Russia's Gazprom and Saudi firms on natural gas.
All of this signals a significant warming of ties between the Saudis and a country whose enemies (the Afghan mujahideen) they once bankrolled in the 1980s.
Why are ties growing?
Put bluntly, the Saudis no longer trust the US and the West as much as they used to. That doesn't mean they necessarily trust Moscow either, but recent events in the Middle East have triggered a major rethink in Saudi court circles.
The first big shock came with the Arab Spring protests of 2011. The Saudis - and other Gulf Arab monarchies - were appalled at the speed with which the West dumped its long-time ally, President Hosni Mubarak of Egypt.
By contrast, they couldn't help noticing that Moscow stood by its beleaguered Middle East partner, Syria's President Bashar Al-Assad.
The next shock came with President Barack Obama's support for the Iran nuclear deal in 2015, which left the Saudis feeling deeply uncomfortable. They suspected, rightly, that the Obama White House was losing interest in the region.
When the newly elected President Donald Trump chose Riyadh for his first overseas presidential visit in 2017 the Saudis were ecstatic. Relations with Washington appeared back on track and billions of dollars' worth of deals were announced.
But then came the murder by Saudi government agents of the Saudi journalist Jamal Khashoggi in October 2018 which resulted in massive condemnation in the world's free press.
Suspicious of his involvement, Western leaders started to give Saudi Crown Prince Mohammed Bin Salman a wide berth, at least in public. At the G20 summit in Buenos Aires the following month he was largely shunned.
By contrast, President Putin high-fived him.
Although President Trump has lobbied in favour of good relations with the Saudi leadership, Saudi officials are still dismayed by his unpredictable and quixotic approach to the region.
This week the Saudi Ambassador to UK, Prince Khalid Bin Bandar, described the Turkish incursion into northern Syria (triggered by Trump's decision to withdraw US troops there) as a "disaster". When asked about warming relations with Moscow, the ambassador replied that "Russia often understands the East better than the West does".
Eight years on from the outbreak of the Syrian civil war and Russia has successfully helped save Assad's regime, showcasing its latest military hardware while simultaneously establishing a strategic foothold in the region.
America under President Trump, meanwhile, appears to be heading for the exit, despite rushing extra troops to shore up Saudi Arabia's air defences after the equipment it had sold the Saudis failed to prevent the catastrophic attack on 14 September.
Bottom line: the Saudis and their Gulf Arab allies are looking to diversify their partnerships away from a heavy dependence on the West.
This is to hedge against any future upsets, be they incoming missile attacks they blame on Iran (which could in future risk killing Russian technicians) or diplomatic upsets like the Khashoggi incident.
What happens next?
All of this needs to be seen in perspective.
Saudi Arabia's prime security partner has been, and continues to be, the United States. This dates back to 1945 when President Roosevelt met Saudi King Abdulaziz onboard a US warship.
Over the ensuing years the Saudis guaranteed to keep the oil flowing, America promised them a security umbrella. That pact, while somewhat frayed at the edges, remains.
The US military has substantial bases in all six Gulf Arab countries. The nuclear-capable US Navy's 5th Fleet, headquartered in Bahrain, remains the most potent navy in the region. When Mr Trump came to Riyadh, more than $300bn worth of deals were announced; when Putin came this week, it was $2bn.
But there is no question that the tectonic plates of alliances in the Middle East are shifting and diversifying. Expect to see more visits by Russian and Chinese delegates to Riyadh.
America still has a prime seat at the Saudi table, but there are rather more guests sitting round it now.