Anti-government protesters clash with police in Caracas, Venezuela. (Miguel Gutierrez/EPA)

Venezuela's government has managed to turn the country with the world's largest oil reserves into a pauper state where food is scarce, violence is abundant and money is worthless.

Despite that, however, its grip on power still seems strong. It has packed the courts, bullied the press and replaced the opposition-led legislature with a much more pliant one filled solely with regime apparatchiks. Not even mass protests have been able to stop this slide into authoritarianism. Why not? Because Nicolás Maduro's Venezuela has learned what Robert Mugabe's Zimbabwe did a decade ago: that you can get people to stick with you no matter what if they think your opponents are their enemies.

It turns out, then, that revolutions do not live by bread alone. They need polarization, too.

That's the only way to explain the otherwise inexplicable fact that the two of the most economically destructive governments in recent memory have also been two of the longest-lasting. Indeed, Venezuela has the world's worst inflation rate, second-worst unemployment rate, third-worst murder rate and 10th-worst corruption score. To give you an idea of how dire things are, the International Monetary Fund estimates that inflation is more than 1,100 percent right now and will get up to more than 2,000 percent by year's end. (The government, of course, doesn't bother publishing its own figures anymore). This has meant death for the nation's currency. It lost 99.7 percent of its value, going by black market prices, from the start of 2012 to the end of 2016, and then another 98.3 percent since. Altogether that's a 99.99 percent drop over the past six years. Which, as my colleague Anthony Faiola reports, is how something as simple as a Transformers toy could end up being worth 10 months of someone's pay.

It was the same story in Zimbabwe, only orders of magnitude worse. Its economy shrank 50 percent between 1998 and 2008 at the same time that inflation exploded to such astronomical levels that, according to Johns Hopkins professor Steve Hanke, prices got to the point where they doubled daily. It was the second-worst hyperinflation in history, and the country still hasn't fully recovered. Even today, Zimbabwe's economy is 10 percent smaller than it was 20 years ago.

Now, "9 times out of 10" a "government that performs this poorly economically over time is likely to fall," said Steven Levitsky, a Harvard political scientist and co-author of the new book "How Democracies Die."

It will either get forced out of office by voters, protesters, the army or even ambitious members of its own party who want to preserve a political future for themselves. But in any case, somebody will stop it before its failed policies turn the county into a failed state.

Unless, that is, the government can divide the people. It's the oldest trick in the book. See, while it's true that elections can always be canceled, demonstrators shot, generals bought off and defectors made examples of, these kind of dictatorial tactics invite a massive backlash. They also require at least the tacit support of the rest of the regime. The president, after all, can give the order to fire on the crowd, but the soldiers still have to carry it out. What an economically unsuccessful autocrat needs, then, is something to keep everyone outside the government from coming together and everyone inside it from falling apart.

And that's an ideology.

It's about the only thing that Venezuela and Zimbabwe do have anymore. Both of their ideologies were born in opposition to extreme inequality and the ancien régimes that let it fester. In Venezuela's case, that was the gap between the rich and poor that previous governments were too busy carrying out IMF-approved austerity measures to do much about. In Zimbabwe, it was the racial caste system that the colonial authorities had first put in place and the white settler state had then continued. Which is to say that these had long been deeply divided societies. Venezuela's Chávistas and Zimbabwe's Zanu-PF just organized politics around this fact. The problem, though, is that it's easy for that to feed an ever-increasing cycle of polarization. For parties to go from being competing interest groups to hostile tribes. And for politics itself to just become war by other means — so everything is permitted.

Including trying to take over the commanding heights of the economy. That, at least, is what both the Chávistas and Zanu-PF did in response to their rule being challenged. Neither was willing to tolerate any source of power, whether political or economic, being beyond their control. The revolution was too important and their enemies too untrustworthy.

Which is why, back in 2003, Venezuelan President Hugo Chávez replaced 18,000 striking workers at the state-owned oil company who knew what they were doing — about 40 percent of the total — with 18,000 people who knew they were loyal to the regime. The predictable result was that oil production flatlined just when the government needed it the most to underwrite its ambitious new social spending. Even triple-digit oil prices weren't enough for it to be able to pay its bills, so it just printed what it needed — which became a lot more after oil crashed in 2014. Now, the Chávistas have made as many other mistakes as you would expect the economically illiterate drug cartel that it is to make, but this is the most basic one: They tried to get control of the goose that laid the golden egg and killed it instead. No amount of money-printing could cover this up.

Zimbabwe was no different, except that it went bankrupt much more suddenly than gradually. It began in 2000 when Mugabe lost a constitutional referendum that would have given him even more power. He blamed the country's white farmers for this and decided to get back at them at the same time that he tried to burnish his own popularity by simply taking their land and giving it to his black supporters. It was the worst answer to the hardest question. Like a lot of post-colonial states, Zimbabwe had been trying to balance what was good for its economy with what was fair for its historically oppressed people. Which is to say that it didn't want to break up the white farms that made up the backbone of its export economy so fast that their production fell, but it did want to break them up eventually. And up until this point, Mugabe had settled on maybe the best possible compromise: selling white-owned farms to black buyers whenever they came onto the market. But no more. Now the government was just taking whatever it could as fast as it could without any regard for whether the cronies it was giving land to actually knew how to farm it. They didn't. And so Zimbabwe ceased to have an economy ... but it didn't cease to have a printing press. That's how it ended up with a bill worth 100 trillion Zimbabwean dollars.

The irony is that these governments have failed for the same reason that people have stood by them even as they have. That's polarization. "The Chávistas really, really hate their opponents," Levitsky told me, and still think of them as "imperialist stooges who want to bring back the old order." That makes "splitting with Maduro" seem like "going over to the enemy," even though his government has created a humanitarian crisis in which three-quarters of Venezuelan adults lost weight in 2016 for an average of 19 pounds each.

Mugabe was similarly able to survive one of the biggest economic catastrophes in modern history, because, Levitsky said, he was "the leader of a pretty disciplined liberation party that was able to use the memories of the war and its own heroism to close ranks." It was only when Mugabe tried to make his wife next in line to take office that he was deposed. The regime, though, goes on.

But that doesn't mean that nothing matters or that these governments will never fall. "The conditions for an internal split in Venezuela are actually very good," Levitsky told me, because the country's "deepening fiscal squeeze" should lead to more "battles over power and resources" between different elites. But it does mean that extremism in defense of a leader is no virtue. Staying loyal to the president even if he, say, shot someone in the middle of the street is the kind of thing that leads a nation to ruin.

That's true whether you're talking about Venezuela or Zimbabwe or a lot closer to home.