Venezuelan President Nicolás Maduro has fired or arrested nearly all of the people running the company’s massive oil industry and put a general with no experience in oil whatsoever in charge. It’s a dramatic purge that has rattled the industry in the midst of the country’s severe economic crisis, and another sign the country is growing more authoritarian.

The arrests and firings began after Maduro expanded his powers this summer by successfully pushing for the election of a special new law-making body packed with loyalists that replaced the existing opposition-controlled legislative branch of the government. That election was held in defiance of months of street protests against Maduro that left at least 46 people dead and resulted in international sanctions from the US.

In August that new body appointed a new attorney general, Tarek William Saab, who has since led a campaign to fire and arrest dozens of oil officials under the banner of weeding out corruption. The country’s state-owned oil company, PDVSA, has a long-held reputation for shady conduct, and Maduro’s regime has argued that the company needs to root out graft to become more efficient and deliver more revenue for the government.

But analysts say that arrests also serve another purpose: consolidating power for a beleaguered president who has lost the trust of the country’s population as it endures widespread food shortages and teeters on the edge of a debt crisis. Venezuela is currently struggling to service about $120 billion worth of debt as its economy remains locked in a tailspin due to plunging global oil prices.

Since August, Saab has arrested 65 oil officials and managers for charges ranging from corruption to sabotage. That string of arrests has included six executives from Citgo, PDVSA’s Houston-based refining subsidiary.

Analysts say that while the arrests began with mid-level executives, Saab has begun to target more high-profile officials over time.

This week Maduro’s regime pulled off its biggest arrests yet, and it was a carefully orchestrated spectacle. On Thursday, Saab announced the arrest of Nelson Martínez, the official who led PDVSA until being fired this week, and Eulogio del Pino, a former oil minister. As Saab announced the arrests at a press conference, video footage of their detainment was broadcast on state television, which included a sequence in which government agents wearing ski masks and wielding assault rifles show up at Del Pino’s home.

The optics aren’t subtle. “The government is trying to show that they are battling corruption and they are going to work to increase oil production,” Claudio Rodríguez, an analyst for Caracas Chronicles, an opposition-friendly news and analysis site, told me.

But Rodríguez says that there are other motives at play as well — Maduro is also attempting to clear the powerful oil company of potential rivals.

“It’s a purge for Maduro to consolidate power and get rid of people who might threaten him or have more market-friendly politics,” Rodríguez said.

Maduro is striking out at his enemies because he knows he’s vulnerable

Analysts say that Maduro has targeted Del Pino and other PDVSA officials who are close to Rafael Ramírez, a powerful figure in Venezuelan politics who has openly castigated Maduro in recent months from his post as Venezuela’s ambassador to the United Nations. Reuters reported on Wednesday that Ramírez has been stripped of his ambassador title, but that hasn’t yet been confirmed by the government itself and analysts are unsure of what his official position is at this moment.

But the reason Ramírez and his allies are being targeted is clear: As a former head of PDVSA, Ramírez is a well-connected player in the Venezuelan scene and he has emerged as a potential challenger to Maduro in next year’s presidential election.

Furthermore, Maduro’s anti-corruption arrests also allow him to claim a scapegoat that can explain Venezuela's economic debacle.

“Everyone knows that PDVSA is Venezuela's economic motor, and if Maduro can blame its executives for the crisis, it partially deflects the blame from his own administration,” David Smilde, a scholar of Venezuela at Tulane University, told me.

Maduro is doing more than just kicking people out of PDVSA — he’a also installing loyalists. On Sunday, he announced that Maj. Gen. Manuel Quevedo would take control of PDVSA. Quevedo is a former housing minister with no experience in the oil sector.

Miguel Tinker Salas, a historian of Venezuela at Pomona College, told me that Maduro hopes to sell the idea that “a general will bring order and stability to the institution,” and revive efficiency.

But this is about more than just installing a leader with loyalty to Maduro. It’s also a gesture of Maduro’s loyalty to the military. Maduro is faring poorly in polls, he’s presiding over the most dire economic crisis in South America, and he’s continually resorting to authoritarian policies to keep his grip on power. He knows that he is extremely vulnerable to a military coup, and he has progressively given the military more control over the government during his presidency in order to ward off that possibility.

In the past he’s given the military control over a television station, food imports, and a bank. Now he’s given them control over the most lucrative part of the Venezuelan economy.

“The military is Maduro's security blanket and he is making sure they have a stake in the continuation of his presidency,” Smilde explains.

Rodríguez says that the military would likely expect to be able to inherit the tradition of corruption at PDVSA and funnel money into their own coffers.

Maduro’s power play has short-term benefits and long-term costs

Analysts say that Maduro likely has secured more stability for his own government by at least claiming to address the issue of corruption — which has been an issue in Venezuelan politics for decades — and installing more loyal officials in the state-owned company.

But there are a lot of potential costs here as well.

Venezuela’s oil industry has lost its most experienced decision-makers and officials with incredible speed, and the top official at the helm of PDVSA has no experience in the sector at all. That doesn’t bode well for Venezuela’s lagging oil production.

“If all experienced people are removed from PDVSA, you can expect a more steep drop in oil production, and that will lower revenue for the government,” Rodríguez says.

And foreign investors are likely to read Maduro’s move as a political power play, says Smilde. That will only discourage them further from pouring any money into the country’s ailing economy.

But during his nearly five years in power, Maduro has never shown an eye for making the hard decisions needed to improve the economy. What he has shown is that he’s willing to do just about anything to cling to power.