Brazilian President Michel Temer is engulfed in a corruption scandal. He says he won't resign, but his job is still at risk. He was allegedly recorded organizing huge money payoffs to a crucial witness in an unfolding corruption case.

International readers might perk up. Wasn't it just last year that a different Brazilian president was engulfed in a large corruption scandal? Why yes, it was.

This was predictable: When Dilma Rousseff, Temer's predecessor, was impeached, moving him from the vice president's office to the president's, I wrote at the time that he was "by some reckonings more corrupt" than her.

In fact, political corruption is endemic in Brazil. At the time of Rousseff's impeachment, more than half of the members of Brazil's legislature were either indicted or under investigation for corruption or related offenses.

The country is being thrown into turmoil for a number of reasons. The first is what's known as Lava Jato, or "Operation Car Wash," a very large sting operation into corruption by Brazil's Federal Police. The investigation started as a probe into money laundering but quickly grew to embroil large swathes of Brazil's political class on the back of what's known as the Petrobras Affair, named after Brazil's state-owned oil company.

The details are complex but the gist is that politicians reportedly used the country's oil riches as a slush fund and put it at the center of kickback schemes to enrich themselves. Some politicians are alleged to have received the equivalent of tens of millions of dollars. Most of the political class, down to the once much admired and beloved former President Luis Ignacio Lula da Silva, seems to be implicated in some way.

This in and of itself would be a massive crisis in any country. But this political crisis is arriving on the back of a deeper socioeconomic crisis.

The 2000s were a happy time in Brazil. The country is commodity-rich, the 2000s were a commodity boom, and Brazil had one of the fastest-growing economies in the world. A rising tide lifts all boats; President Lula implemented social programs that improved the lives of the poor without squelching growth. Given the country's history of dictatorship, hyperinflation, and social stratification, Brazil suddenly seemed like an example to the world: a vibrant democracy that was enjoying growth while tackling inequality. This was the time when the major emerging countries, the so-called "BRICs," seemed to own the future. Brazil had problems, for sure, but it was quickly moving in the right direction, the 2000s seemed to say.

The commodity slump that began in 2008 exposed much (though not all) of this narrative as a mirage. Live by commodity prices, die by commodity prices. To mix metaphors, the rising tide lifted all boats, but when it retreated it exposed many naked swimmers. The persistent inequality that has defined Brazil throughout its history — the notorious favela slums sitting right next to the heavily guarded doors of mega-mansions — had not vanished by magic, but seemed especially unbearable to average Brazilians now that Brazil was a middle-income democracy rather than a poor dictatorship. The government's decision to aggressively pursue hosting the soccer World Cup and the Olympics, designed as a major PR splash to display Brazil's confidence to the world, massively backfired: The billions spent on sports infrastructure of dubious value and theatrics designed to show off to foreigners looked obscene and delusional.

So there you have it. A massive corruption scandal involving most of the political class would be a deep crisis in any context, but in a context of economic slump, inequality, and growing social discontent, it's a deep, deep crisis.

We get the word crisis from Aristotle. In ancient Greece, it was a word of medical jargon (Aristotle's father was a doctor) that meant the moment when the symptoms of a disease become apparent, and thus the moment when the doctor must make the correct diagnosis and apply the correct remedies; the crisis is the moment that determines whether the patient will live or die.

It's in this sense that Brazil is in crisis, but I am hopeful. When Dilma Rousseff was impeached, I wrote at the time that her offenses were relatively minor compared to the norm of the rest of Brazil's political class; her impeachment was less about the accusations (slightly fudging deficit numbers) than about removing a president who had become deeply unpopular. But I wrote that it was good news, because it was an example of precisely what Brazil's political class needs: that wonderful American word, accountability.

Brazil is in a crisis, and the remedy is the rule of law. Given its history of authoritarian government, clientelism, and concentration of wealth, the country has not been successful at building the kind of institutions that allow the rule of law to flourish. In classic Latin style, the country tends to run more on informal relationships and arrangements than on formal rules that apply equally to everyone. The widespread corruption of the political class is merely the symptom of this deeper history.

Another famous example of this kind of social makeup was Italy. In the early 1990s, another investigation into corruption, Manite pulite (Operation Clean Hands) revealed most of the country's political class to be on the Mafia's payroll. Politicians could get away with corruption, so they did. Twenty years later, Italy is not Switzerland, but its political class is much less corrupt, and its institutions much more robust. The rule of law is a wonderful thing, and while it's enormously hard to establish, it is not impossible.

Brazil's own version of Manite pulite has plunged it into a very deep crisis — but, as Aristotle taught us, a crisis can also be a moment of hope.