T HE OP-13 BUILDING at the entrance to the Catia shantytown in Caracas is an ugly red and grey edifice, built a decade ago by a Russian company. With such housing projects Hugo Chávez, the founder of Venezuela’s “Bolivarian revolution”, established himself as the benefactor of the poor. The polyurethane cladding suits Moscow, not the tropics. The windows are too small to admit much breeze. But people who live in Catia are grateful to the government. “It’s completely chavista here,” says Ayax Armas, a cook who lives opposite.

Loyalty is reinforced by fear. Catia is controlled by pro-government colectivos, which are at once local intelligence-services, neighbourhood-watch groups and criminal gangs. Protests against the left-wing regime were almost unheard of. But anger is simmering. The oil boom, which paid for Chávez’s largesse, ended soon after he died in 2013. Under Nicolás Maduro, who took over from him, the economy has slumped and food has become scarce. Annual inflation is 1.7m per cent, according to the opposition-controlled legislature. “Who wouldn’t want to change this situation?” asks Carlos, who scavenges for fruit and vegetables in the rubbish, cleans them and resells them. More than 80% of Venezuelans want Mr Maduro out, according to Datanalisis, a polling firm.

Just before midnight on January 22nd Catia erupted. Residents of OP 13 streamed out, set fire to rubbish that had been piling up for weeks and banged pots and pans. “This government is about to fall,” they chanted. After two decades of socialist rule that descended into ever-greater repression and economic mismanagement, they may just be right.

Since Catia’s rebellion events have moved at a dizzying pace. On January 23rd Juan Guaidó, a young, little-known politician who had been head of Venezuela’s legislature for just 18 days, proclaimed himself the country’s acting president before a cheering crowd in Caracas. He declared the presidency vacant on the grounds that Mr Maduro’s re-election last May was a fraud. In those circumstances, the constitution gives the presidency to the head of the legislature until fresh elections can be held.

Along with more than 1m protesters across Venezuela that day, the United States, Canada and almost all large Latin American countries recognised Mr Guaidó. Britain, France, Germany and Spain said they would follow if Mr Maduro doesn’t call a free election within days.

President Donald Trump has moved to make Mr Guaidó’s claim a reality. On January 28th America imposed its toughest sanctions yet on Venezuela’s regime. It froze the American accounts and assets of PDVSA , the national oil monopoly, and said that it will divert the proceeds of further sales into an account that will be accessible only after PDVSA comes under the control of Mr Guaidó or an elected government. This cuts off the regime from its main source of cash. Already it has defaulted on most of its debt and is short of money to buy the loyalty of the armed forces, maintain oil production and import enough to feed 32m Venezuelans. The new sanctions will make all that even harder.

Venezuela thus finds itself part of a trial of strength. A peaceful transition to a democratic, economically literate government could restore normality to what was once one of the region’s richest countries (see article). Equally, the Trump-Guaidó gambit might lead to conflict between armed groups or simply fail, leaving the regime more dominant than ever. In that case, millions more Venezuelans would join the 3m who have already fled, mostly to neighbouring countries such as Colombia. American prestige, wagered on ousting Mr Maduro, would suffer, too.

Mr Maduro has resisted growing opposition since 2013, when poverty began to rise (see chart). As Venezuelans turned against him, his power came to depend on a patronage network of enchufados, or “plugged-in people”, especially in the security forces. He has appointed over 2,000 officers to the rank of general or equivalent. The army runs companies in as many as 20 industries, including an insurer, a rubber manufacturer and a television channel, according to Crónica Uno, a newspaper.

The armed forces collar scarce dollars at an artificially cheap rate and sell them to dollar-starved companies at a much dearer one. The national guard smuggles petrol, weapons, food, gold and diamonds, according to Margarita López Maya of Universidad Central de Venezuela, citing investigations by American authorities. After Mr Guaidó’s proclamation, all of the country’s top brass pledged support to Mr Maduro.

They have stomped on dissent. At the protests in Catia the colectivos were first on the scene, followed by the dreaded FAES , an elite police force (“colectivos with a licence”, Mr Armas calls them). “We are not going to let anyone fuck with us,” said one colectivo leader in Catia after the fracas. Repression took place across the country on the next day. Some 700 people were detained, a record number for one day, according to Foro Penal, a human-rights group. Thirty-five people were killed.

But the oppressors are also unhappy. Despite the money to be made from corruption, the crisis affects the armed forces as it does the rest of society, says Rocío San Miguel, a Caracas-based military analyst. The salary of a major in the national guard is 36,000 bolívares a month, worth less than $15. “That is not enough for two days’ worth of food for a family of four,” says Ms San Miguel.

Growing disgruntlement in the security forces increases the importance of the several hundred Cuban counter-intelligence agents (supplied in return for cheap oil) who also prop up Mr Maduro’s rule. They tap Venezuelan phones to monitor dissent as well as looking after the president’s personal security, says a western intelligence source. He adds that Mr Maduro gets an intelligence briefing every morning from two Cuban officers. The most intense snooping is on the police and armed forces—anyone with a gun, says Ms San Miguel.

The regime has disrupted several coup attempts. Around 100 senior officers are in prison, including several who were close to Chávez and who served Mr Maduro as ministers. Troop commanders have been shuffled frequently to prevent them from building close relations with their soldiers, according to Caracas Chronicles Political Risk Report, a newsletter.

Even before the latest sanctions, the regime was running out of money to keep the generals happy. Production by PDVSA , which has been mismanaged for years, was expected to fall to less than 1m barrels a day in 2019, its lowest level since the 1940s. If sold at world prices, that should bring in about $20bn for the year, except that 45% of the oil goes directly to China and Russia to repay debt, according to Siobhan Morden of Nomura, an investment bank. Cash from oil sales goes mainly to pay other claimants and to pay Venezuela’s import bill. Less than $250m would be left to spend on patronage. That is less than the wage bill for Manchester City’s footballers. Venezuela would have to dip further into its dwindling foreign-exchange reserves.

With the new sanctions, money will be even tighter. They freeze PDVSA ’s $7bn of assets in America, which include three oil refineries, and will reduce revenue from oil exports by more than $11bn, says the Trump administration. PDVSA might find other buyers, perhaps in Asia, but is likely to earn less because transport costs will be higher. Almost as painful is the ban on the sale of diluents to PDVSA , without which its thick oil will not flow through pipes.

These measures will accelerate Venezuela’s economic collapse. GDP will shrink by 26% this year, bringing the total decline since Mr Maduro took office to 60%, estimates Francisco Rodríguez of Torino Capital, an investment bank. Bond prices suggest that the markets put the odds of Mr Maduro’s ousting at 50-90%.

Mr Guaidó and Mr Trump are betting that hardship will topple the regime before it starves the Venezuelan people. The opposition is striving to persuade the armed forces to switch allegiance. The national assembly passed a law offering amnesty for those who help “build democracy”. Volunteers distributed pamphlets laying out the terms at army bases (some soldiers burned them). To members of the regime too discredited to be part of any democratic government, including Mr Maduro, the opposition is offering passage to a comfortable retirement, perhaps in Cuba.

He is not ready to be pensioned off. He has called for support from China and Russia. On January 26th their UN ambassadors rebuked America for interfering. Both countries have big financial stakes in Venezuela. China, which has extended a total of $60bn in loans over the past 20 years, is its biggest creditor. And Russia has lent $17bn to oil projects and to finance arms sales.

China, which takes a hard-headed view of Venezuela, has promised little new money. It is to Russia’s authoritarian leader, Vladimir Putin, that Mr Maduro has turned. Mr Putin sees Venezuela as a stage for his confrontation with America. Sergei Lavrov, Russia’s foreign minister, said his government will do all it can to support the Venezuelan president. Unconfirmed reports say that 400 men from Wagner, a military company owned by an associate of Mr Putin, flew to Venezuela, perhaps to protect Mr Maduro from his own officers.

It is hard to see Russia committing troops or much treasure to keeping Mr Maduro in power. But Mr Putin would profit from other outcomes, too. Violence would demonstrate the risk of allowing a mob to subvert an established leader. An American military intervention could be cited as evidence that America shares Mr Putin’s belief in great powers’ spheres of influence.

Without Chinese or Russian cash, Mr Maduro will have to rule on emergency rations. That can work for a while. As people become poorer, the cost of patronage falls. Voters who once expected a flat now accept a box of food. But the forces working to topple Mr Maduro are getting stronger while those holding him up are weakening. For Venezuela’s sake and his own, he should take early retirement.