Demonstrators demand the impeachment of Brazil's President Dilma Rousseff during a March rally in Brasilia. A large inflatable doll depicts a former president in prison garb. (Eraldo Peres/Associated Press)

Woe is Brazil. As August’s Summer Olympics approach, Latin America’s largest country — with a population of 206 million and an economy that is 40 percent of the region’s total — is caught in a harsh slump and faces a political crisis that could result in its president being impeached. How did this happen? What does it mean?

A decade ago, Brazil was a poster child for “emerging market” countries whose surging economies would ultimately make them wealthy nations. Remember BRIC: The acronym stood for “Brazil, Russia, India, China,” which were the anointed leaders. From 2004 to 2008, Brazil’s economy averaged growth of almost 5 percent a year, reports the Organization for Economic Cooperation and Development.

No more.

Economist Rafael Amiel of IHS, a consulting company, reports that the country’s economy has been shrinking since 2014 and that he expects cumulative decline of gross domestic product — total output — to be 8.5 percent. That’s roughly twice the GDP drop (4.2 percent) the United States suffered in the Great Recession. Brazil’s national unemployment rate has risen from 6.7 percent in mid-2014 to 9.5 percent at the end of 2015. It will probably go higher.

Some of the slump stems from the collapse of commodity prices. Brazil is a major exporter of raw materials, including iron ore, soybeans, oil and coffee. “But the bigger part of the story is macroeconomic mismanagement,” says Monica de Bolle, a Brazilian economist at the Peterson Institute, a think tank.

With Brazil’s president and her predecessor embroiled in a growing corruption scandal, supporters of the governing Workers’ Party took to the streets in rallies Friday and were joined by sympathizers arguing that recent escalations in the investigation threaten their young democracy. Correction: An earlier version of this video said that Brazil's President Dilma Rousseff is under investigation. She is not. Her predecessor Luiz ­Inácio Lula da Silva is. (Whitney Leaming,Thomas Johnson/The Washington Post)

To bolster the reelection of President Dilma Rousseff in 2014 — the allegation goes — credit was kept cheap, and government spending and deficits expanded. Now those policies have been reversed to check the adverse side effects. The budget deficit, which had been running 2 to 3 percent of GDP, ballooned to 10 percent in 2015. Inflation reached nearly 11 percent last year, says the rating agency Moody’s. Interest rates have been raised and spending squeezed.

The accusation against Rousseff — the grounds for impeachment — is that she hid the run-up of the budget deficit through various gimmicks. She denies it. A “yes” vote in the Brazilian Congress’s lower house would trigger a Senate trial, unless she resigns. Compounding public outrage is a vast scandal involving Petrobras, the national oil company. Petrobras has estimated the cost of bribes and rigged construction bids at $3 billion. Dozens of executives and public officials have been implicated. In March, 3 million or more Brazilians demonstrated to protest the Petrobras scandal and Rousseff.

No one knows where this mix of economic disappointment and political disillusion is leading. One hopeful possibility is that Brazil’s casual tolerance of graft may be fading, speculates Paulo Sotero, a veteran Brazilian journalist who now heads the Brazil Institute in Washington. He cites one poll in which nine of 10 Brazilians want the Petrobras prosecutions to continue even if they hurt the economy.

“A change of attitude toward corruption [may be] under way,” he writes. “The passivity that was once expected of law enforcement officials . . . is a thing of the past.”

But for now, political and economic dysfunction feed on each other. Political turmoil saps confidence, which weakens the economy and deepens political discontent. “Businesses are delaying investment, even of replacing worn-out equipment,” says economist Amiel of IHS.

Changing economic policy will be difficult. As in the United States, reducing big budget deficits is unpopular. Many Brazilians retire by 55, says de Bolle; social security’s eligibility age should be raised to 65. Much social spending is uncontrolled, because the constitution requires that it increase with inflation or tax collections. These restrictions should be relaxed, she says. Similarly, the role of state banks — which flood the economy with subsidized credit — should be curbed.

What Brazil teaches is that the promise of “emerging market” countries was often wishful thinking. The presumption was that these countries, especially the BRICs, would inexorably narrow the gap with advanced societies. They would adopt known technologies, expand their education systems and improve local management. What got lost in this simplistic vision was the impact of national differences — of values, institutions, politics, policies — on smooth economic growth.

With details changed, Brazil’s experience mirrors what’s happened in China and many emerging-market countries. Contrary to hopes after the 2008-2009 financial crisis, these countries have not been sufficiently dynamic to serve as a “locomotive” for the rest of the world, replacing advanced nations. Brazil is important in its own right. But it is also part of the larger story of why the world economy has struggled.

Read more from Robert Samuelson’s archive.