Brazilian President Dilma Rousseff in Brasilia on Wednesday. (Andressa Anholete/Agence France-Presse via Getty Images)

AS PRESIDENT Obama traveled from Cuba to Argentina this week, he literally passed over Latin America’s most momentous political developments — which are not the U.S. rapprochement with the Castro regime or the abrupt switch from leftist populism to center-right liberalism in Buenos Aires, but the huge crisis of corruption and political legitimacy in Brazil.

For more than a year, the world’s fifth-largest nation has been stricken by recession and convulsed by investigations into kickbacks involving the state oil company, the country’s largest construction companies, and scores of high-ranking politicians. Last week, the drama rose to a new level. First, more than 3 million Brazilians turned out to protest the corruption and demand the ouster of President Dilma Rousseff. Then Ms. Rousseff, already facing a congressional impeachment initiative, resorted to a desperate and unscrupulous political manuver.

Ms. Roussef appointed former president Luiz Inácio Lula da Silva as her chief of staff. The move might have made sense a year ago, when he remained a hugely popular national icon, but Mr. da Silva has recently become a target of the ongoing corruption investigations, suspected of accepting bribes and hiding his ownership of a beachfront condominium. His appointment had the effect of shielding him from the federal and state judges and prosecutors pursuing him — and one of them released wiretapped phone conversations that appeared to show Ms. Rousseff and Mr. da Silva conspiring to obstruct the investigation.

Until now, the case for removing Ms. Rousseff from office looked dubious. She was charged with manipulating budgetary accounts before her 2014 reelection, an offense that may have contributed to the country’s severe economic problems but hardly merited impeachment. Her apparent attempt to protect Mr. da Silva, however, may justify congressional action. Opinion has turned sharply against her: One poll says 68 percent of Brazilians favor her ouster, while the newspaper O Globo has reported that the number of legislators supporting her in the lower house has fallen from 250 to 172, barely above the minimum of 171 she needs to block impeachment.

Ms. Rousseff vowed this week never to resign and accused her opponents of attempting “a coup against democracy.” In fact, the silver lining of Brazil’s crisis is that it reflects the country’s maturing democratic institutions and embrace of the rule of law. The federal judge leading the kickback investigation, Sergio Moro, has become a national hero. By the end of last month, no fewer than 84 senior politicians, business executives and others had been convicted on corruption charges, including some of the country’s richest magnates. Hundreds more, including more than half of the National Congress, face allegations of wrongdoing.

The danger is that the country’s political system could unravel, making the critical steps needed to stabilize the economy impossible. Ms. Rousseff, whose administration has been virtually paralyzed for months, could serve her country best by stepping aside and allowing her vice president to preside over a new coalition cabinet. By digging in, she is pushing Brazil to the brink.