Saudi king replaces first in line to the throne with his son, Mohammed bin Salman, the defence chief, state media says.

A previous version of this article stated that the Allegiance Council voted 34 to 31 in favour of the changes. The council in fact endorsed the changes by 31 out of 34.

Saudi Arabia’s King Salman has appointed his son, Mohammed bin Salman, as heir, in a major reshuffle announced early on Wednesday.

A royal decree removed Crown Prince Mohammed bin Nayef, a 57-year-old nephew of the king, as next-in-line to the throne and replaced him with Mohammed bin Salman, 31, who was previously the deputy crown prince.

According to the official Saudi Press Agency, the newly announced crown prince was also named deputy prime minister and maintained his post as defence minister.

The former crown prince was also fired from his post as interior minister, the decree said.

READ MORE: Saudi Arabia’s royal shuffle – All decrees in full

The series of decrees also amended Article V of the kingdom’s statute of ruling, stipulating that, from now on, only the sons and grandsons of the founding King Faisal Al Saud can be kings and crown princes.

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, the decree said.

The council is made up of senior members of the ruling Al Saud family.

The Saudi king called for a public pledging of allegiance to the new crown prince early on Wednesday, the channel said.

Mohammed bin Nayef promptly vowed loyalty to his successor after the decree.

Prince Mohammed bin Naif pledges allegiance to Prince Mohammed bin Salman as the Crown Prince at Al-Safa Palace in Makkah.#SPAGOV pic.twitter.com/cmzGxjwKRh — SPAENG (@Spa_Eng) June 21, 2017

Restructuring power

Mohammed bin Salman has risen to power under his father’s reign. He had previously been in charge of his father’s royal court when Salman was the crown prince.

Over the weekend, the king had issued a decree restructuring Saudi Arabia’s system for prosecutions that stripped Mohammed bin Nayef of long-standing powers overseeing criminal investigations.

Instead, King Salman ordered that a newly named Office of Public Prosecution and prosecutor report directly to the monarch.

OPINION: The Gulf crisis – Royal ambitions and shaky alliances (June 15)

Mohammed bin Salman, embarked on major overseas visits, including a trip to the White House to meet President Donald Trump in March.

That visit to Washington helped lay the foundation for Trump’s visit to Saudi Arabia in May, which marked the president’s first overseas visit.

The trip was promoted heavily by the kingdom as proof of its weight in the region and wider Muslim world.

Yemen and Iran

Prince Mohammed bin Salman overhauled the kingdom’s economy away from its reliance on oil. He also oversees the Saudi-led war in Yemen, as defence minister.

The war, launched more than two years ago, has failed to dislodge Iranian-allied rebels known as Houthis from the capital, Sanaa, and has had devastating effects on the impoverished country.

Rights groups say Saudi forces have killed scores of civilians and have called on the United States, as well as the UK and France, to halt the sale of weapons to Saudi Arabia that could be used in the Yemen war.

The new crown prince also ruled out any chance of dialogue with Iran.

READ MORE: Who are the key players in the GCC crisis?

In remarks aired on Saudi TV in May, Mohammed bin Salman framed the tensions with Iran in sectarian terms and said it is Iran’s goal “to control the Islamic world” and to spread its Shia doctrine.

He also vowed to take “the battle” to Iran.

Iran and Saudi Arabia’s rivalry has played out in proxy wars across the region.

They back opposite sides in the wars in Syria and Yemen and they support political rivals in Lebanon, Bahrain and Iraq.