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

The monarch stripped Prince Mohammed bin Nayef from his title as crown prince and from his powerful position as the country’s interior minister overseeing security. The announcements were made in a series of royal decrees carried on the state-run Saudi Press Agency.

The all-but-certain takeover of the throne by Mohammed bin Salman awards near absolute powers to a prince who has ruled out dialogue with rival Iran, has moved to isolate neighboring Qatar for its support of Islamist groups and who has led a war in Yemen that has killed thousands of civilians.

The prince already oversees a vast portfolio as defense minister and is spearheading economic reforms. He has become popular among some of Saudi Arabia’s majority youth for pushing reforms that have opened the deeply conservative country to entertainment and greater foreign investments as part of an effort to overhaul the economy , including plans to list a percentage of the state-run oil giant Aramco.

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

The Saudi monarch quickly awarded his son expansive powers and named him deputy crown prince two years ago 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 appointment of such a young royal as the immediate heir to the throne essentially sets Saudi policy for decades and removes the challenge of uncertainty. Saudi Arabia’s stock market was up by more than 3.5 percent in mid-day trading.

“He could be there for 50 years,” said Kristian Coates Ulrichsen, a research fellow at the James A. Baker III Institute for Public Policy at Rice University. “If you look at it positively, it is basically setting Saudi Arabia’s course into the 21st century.”

Another young prince also ascended to power on Wednesday. Prince Abdulaziz bin Saud, 33, was named the new interior minister tasked with counterterrorism efforts and domestic security. His father is the governor of Saudi Arabia’s vast Eastern Province, home to much of the country’s oil wealth and most of its minority Shiites. He previously served as an adviser to the interior and defense ministries.

The new interior minister is Mohammed bin Nayef’s nephew, while Mohammed bin Salman is the former crown prince’s cousin. All hail from the powerful Sudairi branch of the royal family.

The royal decree issued Wednesday stated that “a majority” of senior royal members — 31 out of 34 — from the so-called Allegiance Council support the recasting of the line of succession.

The Allegiance Council is a body made up of the sons and prominent grandsons of the late King Abdul-Aziz, the founder of the Saudi state. They gather in secret and vote to pick the king and crown prince from among themselves. It was not immediately clear if the council met before Wednesday’s sudden change.

Even when there is disagreement, the royal family has long followed a tradition of speaking with one voice, particularly on issues of succession, in order to appear united in front of Saudi Arabia’s many tribes and communities.

After the decrees were announced, Saudi TV aired footage of the new crown prince kissing Mohammed bin Nayef’s hand and kneeling before him. Mohammed bin Nayef is heard telling him: “I will rest now, and God help you.”

In celebration of the news, King Salman ordered the reinstatement of all benefits and allowances for government employees that had been curbed by austerity measures, and granted additional days off for the upcoming Eid holiday that marks the end of Ramadan.