Four days before the knock on his door, Venezuela's oil minister tweeted an ode to President Nicolás Maduro: "Thank you, President Maduro, for giving me the honor of being by your side."

Flattery got the oil chief nowhere. In a scene videotaped and displayed on government channels, a masked intelligence agent, clad in black, handcuffed the surprised minister at the door of his home Nov. 30, before hauling him away to a military jail.

Venezuela's government called the arrest of Eulogio Del Pino part of a "historic fight against corruption" that in recent weeks has ensnared dozens of senior officials, especially those linked to the all-important state oil giant, PDVSA. Yet observers say the moves also highlight an escalating effort by Maduro to consolidate power ahead of next year's presidential elections, in which he is expected to seek another term.

The removals include the forced resignation last week of Venezuela's once-powerful envoy to the United Nations, Rafael Ramirez, who some saw as a possible Maduro rival in their United Socialist Party of Venezuela. Del Pino was viewed by some as one of "Ramirez's men" — as were several other arrested officials.

Maduro "seems to be clearing the decks for a presidential run in 2018, trying to reduce the stature and perhaps the freedom of anyone who might be a countervailing center of power," said Eric Farnsworth, vice president of the Americas Society and Council of the Americas, a business and culture organization.

[Even sex is in crisis in Venezuela, where contraceptives are growing scarce]

Maduro, the handpicked successor of leftist firebrand Hugo Chávez, who died in 2013, is among a handful of global leaders identified as threats by the Trump administration — which has described Maduro as a dictator. With Venezuela's economic crisis spiraling out of control and medical and food shortages worsening, the climate here is ripe for dissent.

Yet after suffering a series of arrests and electoral setbacks that many blamed on fraud and intimidation, the political opposition is weakened and divided. One faction, for instance, is participating is Sunday's vote for mayors across the nation, while others are boycotting it, arguing the government cannot be trusted. The opposition is in such disarray that despite Venezuela's myriad problems, a new public opinion poll showed Maduro's popularity jumping to 31 percent, the highest in two years.

With his opposition neutralized as an immediate threat, Maduro appears to be looking closer to home, observers say.

At least one thing is sure: Internal divisions within the socialist party founded by Chávez have rarely been so public.

On Tuesday, Ramirez, the representative to the United Nations and once one of the country's most powerful government officials, announced in a tweet that he was quitting his post at Maduro's request.

"I've been removed because of my opinions, I will continue to be, no matter what, loyal to Commander Chavez," he tweeted.

[Venezuela’s universities feel the sting of economic and political crisis]

Ramirez, a close Chavez ally who ran PDVSA from 2004 to 2014, had been the subject of intrigue for years. The oil giant has been implicated in a number of corruption scandals during Ramirez's reign and afterward. In 2015, officials in Andorra intervened in a bank called BPA after the U.S. government said it was involved in laundering billions of dollars, including money pilfered from PDVSA. Ramirez has denied wrongdoing, as has BPA.

Speculation in Venezuela has raged that Ramirez was considering a run for the presidency, backed by Chavez's daughter, Maria Gabriela Chávez, who has worked with him at Venezuela's mission at the United Nations since 2015. In mid-November, Ramirez published an article on a leftist website in which he criticized the Maduro administration's handling of the economy.

Ramirez's differences with Maduro were evident for years, said Isaias Medina, who, until July, worked for Ramirez at the mission.

"Maduro sent Ramirez to the U.N. to get rid of him after he disagreed on the way Maduro was running the economy," said Medina, who cited differences with the government when he resigned his post. "This persecution is a public sign of a fight between criminal blocs."

When Ramirez ran PDVSA, Del Pino was his vice president of exploration and production for more than five years. Experts see Del Pino's detention as an attempt to purge government officials who aren't completely loyal to Maduro.

"I think there's a growing desperation within Maduro's inner circle and with Maduro himself, and we see that manifested with Ramirez and these arrests," said a senior Trump administration official, who spoke on the condition of anonymity because of the sensitivity of the issue.

The man at the helm of Maduro's cleanup operation is Venezuela's chief prosecutor, Tarek William Saab. Since being named to the job in August, he has arrested more than 60 officials on corruption charges.

Three weeks ago, the president and five other executives of Citgo, the U.S. subsidiary of PDVSA, were detained and accused of profiting from fraudulent contracts. In late November, the president of PDVSA, Nelson Martinez, was arrested on charges of money laundering and embezzlement, and this past week Ramirez's cousin, Diego Salazar, was taken into custody on suspicion of money laundering.

Venezuela's oil sector has been widely viewed as corrupt for years. Graft, a lack of investment and poor management are often cited as reasons for its gradual decay. Oil production fell by 650,000 daily barrels between 2011 and 2017, with Venezuelan refineries working at 50 percent capacity.

Saab told The Washington Post through a text message that the fight he's leading to "clean PDVSA" doesn't have political undertones. "That wretched argument is absolutely false," he said.

Last Sunday, in Maduro's weekly show on state TV, Venezuela's leader said the jailed oil officials had "stabbed me in the back. I still feel the wound, but we'll fix it with work and unity to save PDVSA."

But observers say the objective is not to improve the company's precarious situation but rather ensure that the officials running the most important economic sector in Venezuela are loyal.

If government authorities were serious, "they would've named a technocrat, an expert as the new head," said Felix Seijas Rodriguez, political analyst and director of the Delphos polling agency.

Instead, Maduro recently appointed a loyal military man with no experience in the energy sector, Manuel Quevedo, to run PDVSA.

Faiola reported from Miami.

Read more

A Venezuelan woman had grown used to shortages. Then her HIV drugs ran out.

In a hungry Venezuela, buying too much food can get you arrested

Venezuela’s paradox: People are hungry, but farmers can’t feed them

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news