CARACAS/HOUSTON (Reuters) - Venezuela’s powerful former oil czar Rafael Ramirez said on Tuesday he resigned from his job as U.N. envoy on orders of the president, a sign of growing rifts in the Socialist Party once firmly united under late leader Hugo Chavez.

FILE PHOTO: Rafael Ramirez speaks to a reporter at the United Nations in Manhattan, New York, U.S., September 20, 2016. REUTERS/Darren Ornitz/File Photo

Sources told Reuters last week that leftist President Nicolas Maduro fired Ramirez, a political rival who was thought to have presidential ambitions, and summoned him back to Caracas from New York.

Several close allies of Ramirez, as well as a relative, have been arrested in Venezuela in recent weeks as part of a purge in the oil sector over graft allegations, sparking questions about whether Ramirez would dare return to Caracas.

Insiders say Maduro is feeling empowered after surviving major political protests this year. He is now moving to strengthen his control of the OPEC member’s crucial energy industry and sideline political rivals ahead of presidential elections in 2018.

“I have been removed for my opinions,” said Ramirez via Twitter, where he posted a four-page resignation letter.

He has for weeks been writing editorials on a left-wing news site that are harshly critical of Maduro and the state of the oil industry.

“By attacking me personally, you are affecting the unity of the revolutionary forces and the legacy of Comandante Chavez,” he added in the letter addressed to Foreign Minister Jorge Arreaza, referring to Chavez, who governed Venezuela for 14 years before dying of cancer in 2013.

Ramirez, a 54-year-old engineer, did not discuss his next moves in the resignation letter, but a source close to him told Reuters on Tuesday that had left the United States.

His press representative did not immediately respond to request for comment.

RAMIREZ’ FALL FROM GRACE

The sacking caps a remarkable downfall for Ramirez, who led state oil company PDVSA and the oil ministry for a decade and was one of Chavez’ closest confidants. He oversaw vast oil nationalizations and urged workers to wear red shirts in support of Chavez’s socialist movement.

Ramirez was disappointed when Chavez picked Maduro, a former bus driver and union leader, as his successor, according to sources familiar with his thinking. Maduro then narrowly won an election to become president in 2013 and swiftly demoted Ramirez the following year, first to the Foreign Ministry and then to the United Nations.

Since then, a protracted rivalry between the two men has increased, insiders said.

Ramirez has in recent months openly criticized Venezuela’s economy, which has the world’s highest inflation and shortages of basic goods. He wrote an article that was perceived as an attack on Maduro himself, one source said.

The Information Ministry did not immediately respond to an email seeking comment. The government said it had appointed Samuel Moncada, a former foreign minister, as U.N. envoy.

OIL PURGE

Separately, state prosecutor Tarek Saab on Tuesday said Venezuela had ordered the arrests of six oil executives for their alleged role in a 2010 drilling contract with inflated prices.

The announcement comes amid a months-long crackdown on alleged graft in the energy industry that has led to the arrest of some 65 former executives, including two prominent officials who used to lead both the oil ministry and PDVSA.

Corruption has long plagued Venezuela, home to the world’s biggest crude reserves, but the socialist government usually blamed smear campaigns for accusations of widespread graft.

Maduro has recently changed his tack, blaming “thieves” and “traitors” for the country’s crisis.

PDVSA has already started an arbitration procedure against PetroSaudi, the company that leased the offshore rig in the 2010 contract, to seek damages for what it says was “poor performance.” PetroSaudi declined to comment.