The Amazon's Amahuaca people braved marauding rubber tappers a century ago, and now face a new threat to their survival as gold mines and oil wells increasingly encircle their jungle home. They and other indigenous communities have gone to court to protect their rainforest habitat and keep mining and oil projects off their lands.
But activists here fear legal constraints will only delay defeat in their long conflict with miners. In June, Amahuaca villagers in Boca Pariamanu, in the heart of the Peruvian Amazon basin region, celebrated a rare legal victory. A court recognized their claim to more than 4,000 hectares (9,884 acres) of the rainforest, after years of conflict with chesnut producers.
Title deeds to the land are key in a wider battle over Amazon resources, said community leader Julio Rolin. "We need to be able to monitor the land and not be invaded by mining, by illegal logging or invasions by settlers," Rolin told AFP.
The Amahuaca is one of 38 indigenous communities scattered throughout the Madre de Dios river basin, seen as the epicenter of illegal mining in Peru - the world's fifth-largest gold producer.
Indigenous umbrella organization Fenamed warns of a wider threat. Despite the Amahauca's landmark legal victory, the state has altogether granted mining concessions on land occupied by 11 of the 38 local communities. Under Peruvian law, the state retains the rights to the subsoil of indigenous land, so the government retains the right to grant exploration licenses.
"We demand that rights not be granted to third parties in the territories of indigenous peoples," Fenamed president Julio Cusurichi said.
Boca Pariamanu is accessible only by dugout canoe, two hours from regional capital Puerto Maldonado, and much of the illegal mining here takes place without fear of censure.
"Mines contaminate the water, there are no more fish. And it destroys the forest," says Adela Ajahuana, a 23-year old indigenous Arazaire woman.
She fears it is only a matter of time before the mines destroy her own community.
Across the brown Pariamanu river, deforestation has gouged out vast areas of rainforest, with mud craters left behind by prospecting miners.
Mechanical diggers and gold dredgers rumble constantly in the distance.
The government has cracked down on illegal mining high up in the Andes, sending troops to dismantle the wildcat mining town of La Pampa - a mountain outpost that mushroomed in 2008 at the height of the global economic crisis when the demand for gold was at its highest.
But the move failed to reassure local Amazon communities.
"There were 30,000 people living there. Where will they go? They will go to other parts of the indigenous territories," said Cusurichi.
Across the border in the Bolivian Amazon area of Tacana II, a surge of state-supported oil exploration has alarmed locals.
"Our fear is that this is going to destroy our forest," said Juana Ramirez, a young woman from Las Mercedes, one of Tacana II's four scattered villages that are only accessible by boat.
President Evo Morales, who is seeking a fourth term next month, is supporting a mining project that will extract 50 million barrels of oil, as well as large quantities of natural gas.
"We could have said no to it, but there is very strong pressure from the state, very strong threats," said Ronaldo Justiniano, head of the territory.
Prospecting began in 2018, after three years of tough negotiations between the Tacanas and the national oil company YPFB.
Tacana II got nearly 500,000 dollars to compensate for environmental damage caused by the prospecting, or $500 per thousand inhabitants.
But the money "is no compensation for the wealth we have on our territory," said Justiniano, visibly concerned over what may unfold here.
For now, he says his community is relieved to have managed to protect its chesnut trees, which reach a height of 50 meters (160 feet).
Chesnut gathering is an important source of income for the tribe between January and April.