This is a guest post from André Guimarães, executive director of the Amazon Environmental Research Institute, and Stephan Schwartzman, senior director of tropical forest policy at the Environmental Defense Fund.

It may be hard to recall amid all the bad news coming from Brazil these days — the country’s worst recession in 30 years, its unprecedented corruption crisis, and above all the May 12 Senate vote to suspend President Dilma Rousseff and begin an impeachment trial against her — but this country has in recent years occupied a position of critical global leadership on climate change. Brazil is the world’s biggest reducer of greenhouse gas emissions, having slashed Amazon deforestation about 80 percent over the last decade. Brazil also contributed to the success of the Paris climate agreement last December by adopting an absolute, economy-wide emission-reduction commitment — one far more ambitious than those put forward by most developing countries.

The current crisis puts these commitments at risk, threatening a major blow to global climate progress.

Cutting and burning down trees accounts for about 15 percent of the world’s global greenhouse gas emissions, and deforestation in the Amazon has ripple effects on weather patterns around the world, including rainfall as far away as California. While Brazil deserves credit for large-scale reductions in Amazon deforestation, progress has stalled in recent years. Since 2011, deforestation has been oscillating around 1,900 square miles a year rather than continuing toward zero — the goal an increasingly solid scientific consensus says is needed to guard against the risk of forest dieback. Inadequate government investment and a lack of positive incentives for forest protection are largely to blame.

The government is unlikely to allocate these needed resources during the circus of impeachment, which could last up to six months. Furthermore, for Brazil’s international climate commitments to come into force, Congress needs to make them into law — also unlikely to happen soon.

Yet we also see reasons for optimism amid the chaos and corruption.

Brazil’s political meltdown could help bring the nation to a better place. If the ongoing investigations into chronic corruption in public-works contracting lead, as promised, to sweeping anti-corruption reforms and a cleaned-up approach to infrastructure development, that would benefit Brazil’s economy as well as its environment.

And while the national government is in turmoil, Amazon states such as Acre, Pará, and Mato Grosso are beginning to implement their own programs to halt deforestation and build the basis for sustainable, zero-deforestation growth. They are also looking to link with emerging international carbon markets (and pushing for the creation of a Brazilian carbon market) to help finance the transformation to zero-deforestation agriculture. Currently they are hampered by a lack of federal support and ill-conceived efforts from a few federal agencies to stifle environmental innovation, but their ongoing campaigns could spur more positive action from the federal government once the current crisis is past.

Finally, we take hope from the Brazilian public, which is now adamant that pervasive graft and kickbacks in public works must end. More transparent and accountable infrastructure development, including rigorous assessment of environmental and social costs and benefits, would go a long way toward making development more sustainable in the Amazon and elsewhere.

Brazilian citizens also overwhelmingly support punishment for those who have manipulated the public’s money for their own personal and political gain. This does not bode well for Rousseff’s interim replacement, Vice President Michel Temer, who has already been convicted of campaign finance violations, nor for the two-thirds of the Congress that is under investigation or facing indictment for corruption. Dozens of high-level executives and politicians have already been jailed.

Probably the greatest danger is that Brazil’s political crisis could drag on with no clear resolution that the public views as legitimate. That would drain energy and attention from everything else, including urgent economic adjustments as well as climate commitments.

But if Brazil can emerge from this political crisis with less corruption and more transparency, the country will be much better off. Changing the way that public money is spent — and how development is designed and financed — ultimately stands to benefit Brazil’s people, its rainforest, and the world’s climate.