Saudi Crown Prince Mohammed bin Salman’s decision to arrest scores of the country’s most prominent officials and business elites under the banner of an anti-corruption purge last week was a remarkable power play, an unprecedented move designed to concentrate all authority in the Gulf state in one man’s hands.

But the radical shake-up was also about something else: preparing for life after oil.

MBS, as the 32-year-old heir to the throne is widely known, has not just been detaining people — he’s also been seizing billions of dollars of their money. And he’s using this crackdown to make the case to the world that Saudi Arabia is a reformed nation cleansed of graft, and worthy of a big boost of foreign investment.

In other words, the purge is more than just a way of eliminating his rivals and consolidating power. Experts say that MBS sees it as an opportunity to refill his country’s coffers while he works to modernize the stagnating Saudi economy and wean it off its near-total reliance on oil.

MBS’s anti-corruption committee, which he formed just hours before the arrests began on November 4, has pledged to take “whatever measures are deemed necessary” to confiscate the assets of corrupt officials and businessmen.

Saudi authorities have detained more than 200 people and frozen thousands of bank accounts. A US official briefed on the crackdown told the New York Times that the committee has even tried to get some of the people caught up in the sweep to sign over large amounts of money in order to secure better treatment while detained. (At least 17 people have required medical treatment due to abuse from authorities.)

Senior Saudi Arabian prince Miteb bin Abdullah became the first senior figure to be released from detainment in late November after agreeing to pay over $1 billion to settle corruption allegations against him.

The Riyadh Chamber of Commerce and Industry estimates that if the committee attempted to retrieve all the revenue lost to corruption, it could amount to as much as $800 billion.

“A key goal of the arrest campaign seems to be about replenishing state coffers,” Lori Plotkin Boghardt, an Arab Gulf specialist and fellow at the Washington Institute for Near East Policy, told me.

And Saudi officials haven’t been shy about trying to use the arrests to persuade skeptical foreign investors that the country’s notoriously corrupt economy was beginning to change.

“The old ways have ceased to be sustainable long ago and must be replaced,” Majid al-Qasabi, the Saudi minister of commerce and investment, wrote in an op-ed published in the Wall Street Journal on November 12. “The new way will offer a predictable long-term approach and transparent business environment for investors.”

Anxiety over oil addiction also underlies a number of MBS’s other headline-grabbing maneuvers in the past couple of years. Analysts say his moves to legalize driving for women, relax a ban on musical concerts, and curtail the powers of religious police can be traced back, at least in part, to his concern with making Saudi’s economy more efficient, diverse, and attractive to foreign talent.

That means MBS is more than just a power-hungry upstart. He appears to have a real commitment to shepherding Saudi Arabia’s economy into the modern era in order to preempt the financial catastrophe that will accompany a continued decline in oil prices. But that also means upending many of the basic tenets that have governed Saudi life for decades. It’s a risky gamble, and the country’s future hangs in the balance.

Saudi Arabia depends nearly entirely on oil sales. That’s a bad place to be.

From a distance, Saudi Arabia and other Gulf nations like the United Arab Emirates and Kuwait can seem economically invincible. Their vast oil reserves have created rich societies whose elites are known for unfathomable displays of opulence. One example: Saudi Arabia’s king never leaves home without his trusty golden escalator.

But relying on one commodity has made Saudi Arabia and its neighbors very economically vulnerable. And while Saudi Arabia has always known that it should diversify its economy, the pressure created by the plunge in oil prices in recent years has forced it to finally start scrambling to do so.

The sharp drop in global oil prices began in 2014, largely driven by the boom in the world’s supply of oil stemming from the shale revolution in the US. Saudi’s oil exports have lost value quickly: Today, the price of a barrel of crude oil is around half of what it was in early 2014.

In addition, breakthroughs in renewable energy technology and the expected ubiquity of electric cars in coming years means that global demand for oil is likely to decline in the not-too-distant future. Norway, for example, plans to ban the sale of fossil fuel-burning cars by 2025, and the UK and France are starting bans in 2040.

So both from the supply side and the demand side, Saudi knows that oil has bleak prospects and it has to do something about that. Saudi’s foreign reserves have already fallen by more than a third since 2014, declining from $737 billion to $475 billion, and the country has been forced to freeze spending projects.

The government also knows that with less funds it is more susceptible to domestic unrest. Saudi Arabia has long used generous social spending and subsidies on utilities as a way to effectively buy off dissent against its autocratic style of government, such as when it announced $100 billion in spending projects to preempt Arab Spring-inspired protests in 2011.

In 2016, MBS unveiled his plan to ward off future ruin with a program called “Vision 2030.” It’s a grand proposal that involves diversifying the Saudi economy away from oil to generate revenue from sectors like tech and entertainment services. The plan includes huge projects like selling off a 5 percent share of its state-owned oil producer Aramco, turning its neglected beaches into tourist destinations, and investing in a $500 billion megacity where transportation is entirely automated.

“Within 20 years, we will be an economy or state that doesn’t depend mainly on oil,” MBS told Bloomberg Businessweek in 2016.

Changing Saudi Arabia’s economy means changing its society

The major challenge that MBS faces in his quest to change Saudi Arabia’s economy is figuring out how to navigate the obstacles of Saudi society and governance that stand in the way. So far, his approach has been to remove them aggressively.

One example is Saudi Arabia’s announcement in September that women would be able to drive legally beginning in 2018 — a major blow to the country’s conservative clerical establishment. Analysts say it was money, not a sudden awakening to the horrors of institutionalized patriarchy, that motivated the move by MBS and his father.

Hala Aldosari, a fellow at Harvard University’s Radcliffe Institute, told the LA Times that women in Saudi Arabia have been advocating for the ban to be lifted since the 1990s. “The timing had less to do with social pressure and more to do with the government recognizing that in order to accomplish its ambitious economic vision they had to make gradual adjustments,” she said.

With the right to drive, more women can officially join the workforce — today only around 22 percent of Saudi women work. Saudi families won’t need to spend as much money on drivers — many of whom are foreign and whose earnings are sent out of the country — and will have more disposable income to spend on things like shopping, which should boost the domestic economy. Allowing women to drive also makes Saudi more attractive to high-skilled foreign workers and opens up the possibility of expansion into new industries.

The corruption crackdown could backfire

MBS’s corruption crackdown is perhaps his most brazen attempt yet at removing barriers to Saudi economic growth.

First, there are the assets MBS is seizing from scores of Saudi citizens, which could be used to invest in underdeveloped sectors. “He’s working to take economic power away from places where he can’t control the money and putting it into places where he can control the money,” John Volle, a Middle East historian at Georgetown University, told me. “It opens the door to give more resources to make the 2030 dream possible.”

Then there’s the narrative of a Saudi Arabia free from corruption that should attract the attention of foreign investors. It’s not pure optics — corruption is a serious problem in Saudi, and this could counteract it.

Economists and business analysts have pointed out all kinds of illicit and questionable economic practices in Saudi Arabia, such as the way officials routinely embezzle 10 to 25 percent of government contracts. The government also uses red tape to shield businesses owned by many members of the royal family from foreign competition.

MBS’s purge could bring an end to those kinds of practices and discourage them from happening in the future. The fact that his move was motivated by a desire to centralize power and generate money doesn’t necessarily mean that the effects on corruption won’t be real. Consider, for example, how China really has seen a reduction in corruption in the wake of Chinese President Xi Jinping’s draconian anti-corruption campaign that most analysts also see as a power grab.

MBS likely believes that foreign investors could be encouraged by his arrests, but experts say the way he’s going about encouraging them could backfire.

Simon Henderson, director of the Gulf and Energy Policy Program at the Washington Institute, told me he suspects a “mere fraction” of the assets that MBS is seizing will make it into government coffers.

The legal process for transferring assets from detained individuals to the government is unclear, especially if the assets are held abroad and thus in different legal jurisdictions. (The US National Bureau of Economic Research estimates that Saudis have around $300 billion stashed abroad in foreign tax havens.)

And many assets belonging to ultrawealthy Saudis aren’t in cash. They’re in properties that are hard for the government to price and make money off immediately.

“What’s the value of a secondhand grand palace in Riyadh? If it’s available [for sale] to foreigners, what are their chances of getting the title changed?” Henderson said.

He also points out that foreign investors could be spooked by the volatile and arbitrary nature of the detainments. The fact that many of MBS’s captives have experienced injuries that require medical treatment likely won’t give investors confidence in the rule of law in Saudi.

Furthermore, since MBS used his corruption crackdown to single out rivals and opponents, it’s unclear if his allies will clean up their act or assume they can act with impunity.

In a worst-case scenario, Saudi Arabia could be moving from an era of predictable corruption to unpredictable corruption and arbitrary asset seizures. And investors hate unpredictability.

It’ll take months and years to figure out how serious the prince’s initiative is. But one thing is clear: MBS is not lacking in ambition.