Closer ties between Saudi Arabia and US President Donald Trump's administration helped pave the way for a succession shake-up making a 31-year-old prince the kingdom's de facto ruler, analysts say.
On Wednesday King Salman, 81, named his son Mohammed bin Salman crown prince and heir to the throne after firing Mohammed bin Nayef, whose counter-terrorism expertise had made him a favourite of previous American administrations.
Over the past two years Mohammed bin Salman accumulated vast powers at the expense of Mohammed bin Nayef, 57, a veteran law enforcer who served as both crown prince and interior minister.
Mohammed bin Salman chipped away at his authority but Mohammed bin Nayef's popularity with the previous US administration of Barack Obama had prevented his ouster, said Stephane Lacroix, associate professor at Sciences Po university in Paris.
"This all changed when Trump came to power," he said.
After assuming office in January, Trump made it clear that his Middle East partners are Mohammed bin Salman, Abu Dhabi crown prince Sheikh Mohammed bin Zayed al-Nahyan and Egyptian president Abdul Fattah al-Sisi, Lacroix said.
Riyadh welcomed Trump's more aggressive attitude towards its rival Iran, which Saudi Arabia accuses of interference throughout the region.
Mohammed bin Salman was an early visitor to Washington, where he met Trump in March before the president last month made the first overseas trip of his presidency to Saudi Arabia.
Trump received a royal welcome from Mohammed bin Salman and others.
In a speech, the president urged Muslim leaders assembled in Riyadh from around the world to "drive out" extremists and "terrorists".
He singled out Iran as a culprit.
Trump's approach emboldened Mohammed bin Salman and the Abu Dhabi crown prince who seized the chance this month to cut ties with their Gulf neighbour Qatar, analysts and diplomats said.
They accused Doha of supporting groups, including some backed by Iran, "that aim to destabilise the region".
Trump has made statements siding with Saudi Arabia on the Qatar crisis.
- 'Deep instability' -
With his Trump connection established, Mohammed bin Salman "knew that the US wouldn't mind him sidelining MBN," Lacroix said, referring to the ex-crown prince by his initials.
"I think the Trump factor matters tremendously," he said.
On Wednesday Trump telephoned the new Saudi crown prince to congratulate him on his appointment.
Frederic Wehrey, of the Middle East Programme at Washington's Carnegie Endowment for International Peace, said "a lot of signalling" from Washington -- including a more activist regional foreign policy -- influenced the appointment of Mohammed bin Salman as crown prince.
"I think that matters," Wehrey said.
The Saudis were not "waiting for a nod from the (United) States" but the warming of relations played a role alongside domestic Saudi factors, he said.
By making Mohammed bin Salman "de facto ruler" heading the kingdom's most important portfolios, King Salman created "a solid foundation" for his son's policies, said Andreas Krieg of the Defence Studies Department at King's College London.
It signals to Washington that the kingdom is committed to reform "and is the most important partner for the Trump administration" against both Iran and Islamic State group jihadists, Krieg said.
His appointment "is purely about demonstrating a degree of certainty in times of uncertainty," Krieg added.
Mohammed bin Salman must also have "full support" from Saudi royals as pressure mounts from a series of challenges, he said.
These include the relations with Qatar, a military intervention that has continued for more than two years in Yemen, an economy adjusting to the loss of oil revenue, and attempts at social reform in a deeply conservative Islamic nation.
Lacroix said that among the thousands-strong royal family there does not seem to be much opposition to Mohammed bin Salman's appointment, which has concentrated power in one man.
"This is a very new thing... the Saudi regime was always built upon a balance of power between different actors, different factions," he said.
"This is the most autocratic version of the Saudi regime we've seen until now."
With the Saudi royal succession "a done deal," the real issue is how to create the best possible working relationship between the White House and the Saudi royals "at a time of really deep instability and trouble" in the Middle East, said Anthony Cordesman of the Centre for Strategic and International Studies in Washington.