In its efforts to slash its climate-changing emissions nearly to zero by 2050, Rio de Janeiro has chosen a perhaps unlikely place to start: its trash bins.
At a huge waste treatment plant outside of the famed beach city, methane gas released by buried municipal garbage is captured and turned into energy as part of the city's key push to meet its ambitious goals to become carbon neutral.
Every day, trucks unload 10,000 tons of waste at the CTR waste treatment plant in Seropedica, about 60 kilometers (37 miles) northwest of Rio de Janeiro.
The plant turns household and industrial food and yard waste, which once would have rotted in a landfill - creating a major source of climate-change-spurring emissions - into biogas that is sold to industries or to the state's gas company.
The waste treatment plant, unusual in Latin America, can produce 20,000 cubic metres of purified gas an hour, according to Jose Henrique Monteiro Penido, the head of environmental sustainability at COMLURB, Rio's waste management company.
"Everyone talks about recycling but the biggest environmental problem is the organic fraction of garbage," he said.
Once in a landfill, rotting material releases methane that can, in the short term, drive climate change at a much faster pace than emissions from other sources, such as automobiles or air conditioners.
That gas, and the slurry left over from putrefying waste, "is the most serious problem", Penido said.
Rio de Janeiro, part of the C40 Cities initiative - a network of cities pushing climate action - has committed to reducing its climate changing emissions by 20 percent between 2005 to 2020.
The city of about 6.7 million is also one of more than 70 cities worldwide that are aiming to become "carbon neutral" by 2050, meaning they will produce no more climate-changing emissions than they can offset by other means, such as planting carbon-absorbing trees.
Cities account for about three-quarters of carbon dioxide emissions, according to the United Nations, and consume more than two-thirds of the world's energy.
That means whether they succeed or fail in curbing emissions will have a huge impact on whether the world's goals to prevent the worst impacts of climate goals are met.
From planting trees to promoting renewable energy and cleaner methods of transport, such as electric cars and buses, each city is going about achieving its carbon neutral goals in different ways, and with varying degrees of success.
In Rio de Janeiro's case, changes to waste treatment are responsible for about two-thirds of emissions reductions made so far, according to Jose Miguel Carneiro Pacheco, manager of climate change and sustainable development at the city's department of conservation and environment.
Biogas production from the Seropedica plant alone accounts for a third of the reductions in emissions so far in Rio de Janeiro, Pacheco said.
Goals at risk?
Whether Rio de Janeiro will reach its emission reduction targets in full by 2020 is unclear - and the goal is at risk, officials and environmentalists say.
A lack of private investment and delays in large-scale public works have lowered the city government's estimate of the emissions cuts possible by 2020 to 18 percent "if everything stays as it is", Pacheco said.
The launch of an additional waste treatment center, for example, has been delayed, as has a new metro train line for the city, as well as installation of new high-capacity express bus lanes.
The 2020 targets could still be achieved, Pacheco said, but only if the delayed projects - or other efforts - push ahead, he said.
"We need to measure the emission reductions contained in the 2017-2020 strategic plan to see if we can achieve the remainder by 2020," Pacheco said.
But the push for lower emissions comes as Rio struggles to recover from its worst financial crisis in decades, brought on in part by public corruption scandals and lower prices for its key export products, including oil.
That financial crunch has made efforts to attract private funding for clean energy projects and other emissions-reducing ideas harder, Pacheco said.
The city, for instance, failed to find a taker for a public tender to replace the city's 430,000 street lights with energy-saving LED bulbs. It is now looking for a partner to install solar panels in about 1,500 schools, he said.
"The city's economic situation is not favorable for these projects, which demand big investments," he said.
Nationwide, environmentalists fear Brazil's growing deforestation - a driver of climate change - will worsen under the right-leaning government of President Jair Bolsonaro, who took office in January and has promised to open up more protected land for mining and agriculture.
Brazilians consider climate change the main threat to the country's and the planet's safety, above terrorism and the state of the economy, a 2017 study from the Washington-based Pew Research Center found.
For Mauro Pereira, executive director of the non-profit Defensores do Planeta, a youth-led environmental rights group based in Rio de Janerio, the city's leaders are doing too little to keep pledges to curb emissions and ensure residents get a voice in decisions made.
"Until 2012, City Hall did well but not in the last years," Pereira said in a telephone interview.
For instance, he said, when Rio hosted the 2016 summer Olympic games, it had an agreement with the Olympic committee to plant 12 million tree seedlings in the city - and 24 million in the state as a whole - to compensate for the environmental impacts of the event.
Have you read?
But, to date, only about half of those - 5.5 million - have been planted in the city, Pereira said.
In a statement, Rio's City Hall said it was "unaware" of the number cited by Defensores do Planeta and confirmed only a commitment to plant 13,500 trees in the Parque Radical de Deodoro park as an Olympic environmental legacy.
In addition, City Hall said the 24 million tree-planting target was proposed by the state of Rio de Janeiro but was re-evaluated and discarded after the state, the Olympic Committee and other bodies involved found that it was not feasible.
Pereira, however, said he had followed the negotiations for the Olympic games and that the targets were not dropped.
He said the city was doing well on some other environmental measures including improving waste treatment, adding bike lanes to curb emissions and installing solar energy in schools.
He said he was concerned about the effects of climate change in Rio, especially in its poorer areas, and urged city officials to carry out more risk assessments.
Almost every year, torrential rainstorms trigger fatal mudslides and flooding in mountaintop neighbourhoods in and around Rio de Janeiro.
The flatter and largely poor zones to the west of downtown also face a growing heat threat, as climate change brings more extreme temperatures, he said.
"The West zone is very hot - 48, 49 degrees, and that's in addition to torrential rains. We're already worried about the rainy season from January onwards," he said.
"We just want City Hall to comply with its international agreements for the city to become an example for the world."