F OR YEARS Venezuela’s socialist regime has seemed on the verge of collapse. It has so mismanaged the economy that GDP has dropped by nearly half since 2013. Inflation last year was thought to be more than 1m per cent. This, plus shortages of food, medicine, running water and electricity, has prompted some 3m Venezuelans, a tenth of the population, to flee the country. Yet its president, Nicolás Maduro, has clung on by flouting the constitution, repressing the opposition and using the country’s dwindling income from oil, almost its only export, to pay off the armed forces that support him. On January 10th Latin America’s most incompetent ruler was sworn in to a second six-year term.

Yet Mr Maduro’s second inauguration also marked the moment his disastrous presidency lost its formal legitimacy. The election he won in May was an up-and-down fraud. Almost all the members of the Lima group, 14 mostly Latin American countries that worry about Venezuela, declared that they would not recognise him as president. More important, the opposition acquired a young, unifying new leader, Juan Guaidó (pictured), who was sworn in on January 5th as president of the national assembly. That puts him in charge of Venezuela’s last remaining democratically elected institution.

Suddenly Mr Maduro’s demoralised, divided opponents have been galvanised (see article). Tens of thousands of people across the country demonstrated against the regime on January 23rd, the 61st anniversary of the overthrow of Venezuela’s previous dictatorship. Among them were many poor Venezuelans. They have not lightly turned against a regime founded in 1999 by their hero, the late Hugo Chávez. Before a cheering crowd in Caracas, the capital, Mr Guaidó proclaimed himself the acting president—a role the constitution gives him when the presidency is vacant. In what looked like a co-ordinated move, President Donald Trump immediately recognised Mr Guaidó as Venezuela’s interim leader and most of the Lima group quickly followed.

That raises two questions. How likely is Mr Maduro to hold on to power? And what can the world do to hasten his departure? Mr Maduro has faced down big protests before, most recently in 2017, when more than 100 people were killed, mostly by forces loyal to the regime. Although two dozen members of the national guard in Caracas rebelled this month, the mutiny was quickly put down. There is no sign yet that the top army commanders will transfer their allegiance to Mr Guaidó. It is their loyalty, not the support of the citizens, that keeps Mr Maduro going.

Yet Mr Maduro may be running out of road. For the first time since he won a presidential election, in 2013, he faces a single opposition leader who commands wide support. Mr Guaidó must continue to make clear that, should he exercise power, his first act will be to arrange for free elections. Venezuela’s leaders-in-waiting should offer safe passage to Mr Maduro and his cronies to a comfortable refuge, perhaps in Cuba, and a political future to members of the regime who abide by the rules of democracy.

Much has to go right for Mr Maduro’s wobble to become his downfall. America and the European Union should use all the tools at their disposal to promote peaceful change by boosting Mr Guaidó’s parallel government. That could include putting some of the money paid for oil exports into an account reserved for the national assembly, and using the threat of further sanctions to encourage defections from the regime. The backing of the Lima group will help refute Mr Maduro’s taunts that Mr Guaidó is just a gringo stooge. Should its odious regime finally collapse, Venezuela will need massive international support in the form of humanitarian aid, credit and economic and political help.

Until this week, the departure of Mr Maduro and the chavista cabal has been at once overdue and also a prospect for the medium term. Today an immiserated, hopelessly misgoverned country may just be on the brink of something better.