In a series of royal decrees, the monarch strips Prince Mohammed bin Nayef, who was positioned to inherit the throne, from his title as crown prince and from his powerful position as the country’s interior minister overseeing security.

Saudi Arabia’s King Salman on Wednesday appointed his 31-year-old son Mohammed bin Salman as crown prince, placing him firmly as first-in-line to the throne and removing the country’s counterterrorism czar and a figure well known to Washington from the royal line of succession.

In a series of royal decrees carried on the state-run Saudi Press Agency, the monarch stripped his 57-year-old nephew Prince Mohammed bin Nayef, who was positioned to inherit the throne, from his title as crown prince and from his powerful position as the country’s interior minister overseeing security.

Crown Prince Mohammed bin Salman already oversees a vast portfolio that includes defence. He also heads an economic council tasked with overhauling the country’s economy. He had previously been the second-in-line to the throne as deputy crown prince, though royal watchers had long suspected his rise to power.

The prince was little known to Saudis and outsiders before Salman became king in January 2015. He was in charge of his father’s royal court when the latter was the crown prince.

The Saudi monarch, who holds near absolute powers, quickly awarded his son expansive powers to the surprise of many within the royal family who are more senior and more experienced than Mohammed bin Salman, also known by his initials MBS.

The royal decree issued on Wednesday stated that “a majority” of senior royal members from the Allegiance Council supported the recasting of the line of succession. Saudi Arabia’s state TV said 31 out of 34 of the council’s members voted in favour of the changes.

The Allegiance Council is a body made up of the sons and prominent grandsons of the founder of the Saudi state, the late King Abdul-Aziz, who vote to pick the king and crown prince from among themselves.

Over the weekend, the king issued a decree restructuring Saudi Arabia’s system for prosecutions that stripped Mohammed bin Nayef of longstanding powers overseeing criminal investigations, and instead ordered that a newly-named Office of Public Prosecution and prosecutor report directly to the monarch.

Mohammed bin Nayef was not believed to have played a significant role in Saudi and Emirati-led efforts to isolate Qatar for its support of Islamist groups and ties with Iran.

The prince had appeared to be slipping from public eye, as his nephew, 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 Mr. Trump’s visit to Saudi Arabia in May, which marked the President’s first overseas visit and which was promoted heavily by the kingdom as proof of its weight in the region and wider Muslim world.

Saudi-U.S. relations had cooled under the Obama administration after Washington pursued a nuclear accord with Shia-ruled Iran that the Sunni-ruled kingdom strongly opposed.

The warm ties forged between Riyadh and Washington under the Trump administration may have helped accelerate Mohammed bin Salman’s ascension as crown prince.

Despite his ambitions, which include overhauling the kingdom’s economy away from its reliance on oil, the prince has faced failures and strong criticism for the Saudi-led war in Yemen, which he oversees 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 U.S., 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 U.S. already is helping the Saudis with intelligence and logistical support for the bombing campaign in Yemen, and the Trump administration has signaled it could assist with greater intelligence support to counter Iranian influence there.

The crown prince also raised eyebrows when he ruled out any chance of dialogue with Iran. In remarks aired on Saudi TV in May, Mohammed bin Salman framed the tensions with Iran in sectarian terms, and said it was 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. The conflicts have deepened Sunni-Shia enmity between hardliners on both sides.