Saudi Arabia’s King Salman made his son next in line to the throne on Wednesday, handing the 31-year-old sweeping powers as the kingdom seeks radical overhaul of its oil-dependent economy and faces mounting tensions with regional rival Iran.

A royal decree appointed Mohammed bin Salman crown prince and deputy prime minister. He retains the defence, oil and other portfolios.

The previous crown prince, Mohammed bin Nayef, the king’s nephew and a counter-terrorism chief admired in Washington for putting down an al Qaeda campaign of bombings in 2003-06, was relieved of all his posts, according to the decree.

Although Mohammed bin Salman’s promotion was expected among close circles, the timing was a surprise, with the kingdom facing heightened tensions with Qatar and Iran and locked in a war in Yemen.

The royal decree said the decision by King Salman to promote his son and consolidate his power was endorsed by 31 out of 34 members of the Allegiance Council, made up of senior members of the ruling Al Saud family.

Intent on dispelling speculation of internal divisions in the ruling dynasty, Saudi television was quick to show that the change in succession was amicable and supported by the family.

Throughout the early morning it aired footage of Mohammed bin Nayef pledging allegiance to the younger Mohammed bin Salman, who knelt and kissed his cousin’s hand.

Analysts said the change ends uncertainty over succession and empowers Prince Mohammed bin Salman to move faster with his plan to reduce the kingdom’s dependence on oil, which includes the partial privatisation of state oil company Aramco.

“The change is a huge boost to the economic reform programme… Prince Mohammed bin Salman (MbS) is its architect,” said John Sfakianakis, director of the Gulf Research Centre.

Bernard Haykel, professor of Near Eastern Studies at Princeton, said the king’s decision was aimed at avoiding a power struggle between his son and Mohammed bin Nayef by setting the line of succession out clearly.

“It’s clearly a transition that has happened smoothly and bloodlessly. Now it’s clear, it’s straightforward. That kind of clarity lowers the risk. There’s no question as to who’s going to be in charge.”

After Prince Mohammed’s promotion was announced, Saudi Arabia’s stock market surged more than 3 percent in early trade.

“Some people were predicting that this would lead to a division in the family and strife and some kind of revolt. I don’t see that happening,” Haykel said.

Iran’s leadership was critical of comments by Prince Mohammed last month that the “battle” should be taken into Iran, with Supreme Leader Ayatollah Ali Khamenei labelling the Saudi leadership then as “idiots”.

The royal decree did not nominate a new deputy crown prince. The position is relatively new in Saudi Arabia, where kings have traditionally chosen their own successors.

In an apparent attempt to appease the family, the decree had a clause that made clear that Mohammed bin Salman won’t be allowed to appoint one of his own sons as his successor.

As deputy crown prince, Mohammed bin Salman has been responsible for running Saudi Arabia’s war in Yemen, dictating an energy policy with global implications and spearheading plans for the kingdom to build an economic future after oil.

That the royal succession in the world’s top oil exporter is closely scrutinised only makes the speed of Mohammed bin Salman’s rise to power – and the speed with which his better-known cousins were brushed aside – more astonishing.

The announcement follows 2-1/2 years of already major changes in Saudi Arabia, which stunned allies in 2015 by launching an air war in Yemen, cutting back on lavish subsidies and proposing in 2016 the partial privatisation of state oil company Aramco.

Financial analysts said Prince Mohammed’s promotion gave further assurance that key parts of radical reforms to diversify the Saudi economy beyond oil would continue.

“We do not expect to see any major changes to key areas of policy, including economic,” said Monica Malik, chief economist at Abu Dhabi Commercial Bank.

Last year Mohammed bin Salman, or “MBS” as he is widely known, announced sweeping changes aimed at ending the kingdom’s reliance on oil, part of his campaign to tackle systemic challenges that the kingdom has previously failed to address.

POWER BEHIND THE THRONE

Until his father Salman bin Abdulaziz Al Saud became Saudi Arabia’s seventh king in January 2015, few people outside the kingdom had ever heard of Prince Mohammed.

He is currently defence minister, giving him command of one of the world’s biggest arms budgets and making him ultimately responsible for Saudi Arabia’s military adventure in Yemen.

He also heads the Council for Economic and Development Affairs (CEDA), a group of cabinet ministers who meet weekly and which oversees all elements of policy touching on the economy or social issues like education, health and housing.

Prince Mohammed chairs the supreme board of Aramco, making him the first member of the ruling family to directly oversee the state oil company, long regarded as the preserve of commoner technocrats.

But perhaps most importantly, he is the gatekeeper to his father, King Salman, who in Saudi Arabia’s absolute monarchy retains the final say in any major decision of state.

Outside Saudi Arabia, that rapid advance and the sudden changes to longstanding policies on regional affairs, energy and its economy have prompted unease, adding an unpredictable edge to a kingdom that allies long regarded as a known quantity.

Inside, they have prompted admiration among many younger Saudis who regard his ascent as evidence that their generation is taking a central place in running a country whose patriarchal traditions have for decades made power the province of the old.

Saudi Arabia’s main stock index was 3.4 percent higher. National Commercial Bank, the biggest listed lender, which is expected to play a major role in funding some of the non-oil industries Prince Mohammed bin Salman aims to develop, jumped 10 percent.