When Venezuelan security forces jailed opposition leader and alpha rabble-rouser Leopoldo Lopez early last year, President Nicolas Maduro surely thought he’d rid himself of the regime’s worst news cycle.

Nice try, companero.

Lopez’s every smuggled tweet and jailhouse interview has made Maduro look worse by the day.

With legislative elections less than six months away, almost seven in 10 Venezuelans are fed up with Maduro’s administration, and eight in 10 say the country is heading in the wrong direction. More than half of Venezuelans say they are leaning to opposition candidates.

For the first time in the nearly two decades since Hugo Chavez kicked off his experiment in 21st-century socialism, Venezuelans will cast ballots in a contest that is the opposition’s to lose.

This week, after months of equivocating, and following a dramatic 30-day hunger strike by Lopez, the government finally flinched. Maduro set a date — Dec. 6 — for the midterm elections. Maduro also released a few political prisoners, though Lopez was not among them.

The president was right to be reticent. In a land where inflation is racing to 100 percent a year, criminals own the asphalt and grocery shopping is a scavenger hunt, the government’s ratings are in the tar sands.

Once, Chavez’s petropopulism bought loyalty in the barrios and kept palace rivals in check. Now falling oil prices have depleted the Bolivarian cash box and exposed the profligacy of central planners. With poverty rising and shortages of goods from insulin to iPhones, this land of nearly 29 million has lost its revolutionary verve.

That doesn’t mean Chavismo is dead. Though the Comandante is gone, 16-plus years of stacking the courts and the congress – – plus strong-arming the media and the markets — have turned national institutions into Bolivarian echo chambers.

And if Venezuelan voters wavered, the regime’s handlers had a plan. Beyond rank gerrymandering to enhance the socialist party vote, Chavez-era electoral reforms gave disproportionate weight to rural zones, where government traditionally polled well. The new rules also increased the number of lawmakers chosen by straight-out majorities while reducing those selected from closed party lists, a maneuver that favored big-name contenders over upstarts and challengers.

The system was complicated, but worked fine when the revolution was on a roll. In 2010, government candidates took 48 percent of the popular vote but won 59 percent of legislative seats, enough to capture the judiciary and enable Maduro with near dictatorial fiat.

Now it seems Chavismo may have been too clever by half. With Maduro bleeding support, the rules of overrepresentation now favor opposition candidates, who for the first time since 1999 stand to win a majority — perhaps even a supermajority — of the National Assembly and so break the central government’s political hammerlock.

The election is hardly won. Maduro’s opponents are emboldened but still divided, not least between the fiery Lopez and moderates like former presidential hopeful, Henrique Capriles, the governor of Miranda state, who has balked at the radical wing’s calls to take the streets.

And since there isn’t a prayer of fixing Venezuela’s current mess without enacting some bruising austerity measures – – abolishing price freezes, stopping the monkeying with the exchange rate and ending the pennies-per-tank subsidized gasoline, for starters — the anti-Chavistas are in a bind.

“Because the opposition doesn’t have an alternative proposal, it keeps going back to abuses of civil rights and human rights,” New York University historian Alejandro Velasco said. “That’s an international agenda, not a domestic one and may not be enough.”

Count on Maduro to exploit the dissenters’ fault lines, game the rules, jail more critics and roll out all other Bolivarian moves. Whether that will still do the trick in these souring times is another story. Just ask Leopoldo Lopez.

Mac Margolis is a Bloomberg View contributor based in Rio de Janeiro.