First came the coffee growers. Then the charcoal makers. And finally, when the last trees had been cleared, there came the cattlemen, who grazed their cows on the denuded hillsides.
Several centuries of human activity have left a deep scar in the Atlantic rainforest north of Rio.
Between patches of primary forest which are a haven to rare birds and mammals, hill after hill has nothing but thin grass and eroded soil.
Reversing this loss would seem like a lost cause, yet another defeat in the long battle to preserve the environment.
But nothing appears to deter Mauricio Ruiz, whose encounter at the age of 15 with a Brazilian poet made him resolved to bring the phantom forest back to life.
He invested every cent in his pocket -- 20 reals, around $10 -- to start a tree-planting initiative.
Fourteen years later, his organisation, the Instituto Terra de Preservacao Ambiental (ITPA), is beginning to see the rewards of struggle.
Spades and seedlings in hand, its 130 employees and army of seasonal workers are marching across the hills.
In their wake, they have left 670,000 young trees, drawn from 55 native species.
"We hope to reach the million mark by the end of 2012. Our goal is to plant 18 million trees covering 18,000 hectares (69.5 square miles)," Ruiz said.
To green activists and journalists attending the UN Conference on Sustainable Development in Rio, he proudly showed off a stretch of the banks of the Santa Ana river, which supplies the city with much of its water.
"This was all grass three years ago. Now look at this alligator tree," he said, his hand on a rough-barked sapling that was already two or three metres (yards) high.
Flourishing nearby were pepper trees, lapachos, guapuruvu trees, ingas and umbaubas. A few birds chattered in the top branches, several trees had vines that had started to entwine their youthful trunks, and one had a platoon of caterpillars in its leaves -- all encouraging signs of biodiversity.
ITPA is planting the trees in corridors to link up wildlife isolated in forest remants. That way, Miguel Pereira will join the Serra do Mar, a 7.4-million-hectare (18.5-million-acre) biodiversity corridor on Brazil's Atlantic coast.
"By planting trees, we can have a small forest in four years, whereas if we left it to natural recovery, it would take 40 years. But even with planting, it still takes around 15, 20 years to get a full forest," said Ruiz.
Ruiz used to walk the hills as a boy. He says his life changed when he encountered Thiago de Mello, a renowned poet and defender of the Amazonian rain forest.
"We were on a boat on the Amazon. It was a long trip, and de Mello read out a poem he was writing. It was about a dialogue between two great rain forests. I was very impressed. I told him where I came from, and he said I should go back and help my forest to recover."
Armed with just a high-school education, Ruiz set about learning about tree-planting by getting his hands dirty and listening to environmentalists.
The hills are owned by a mix of small, medium and large landowners, many of whom were initially suspicious of the campaigners.
ITPA talked them round by pointing out the benefits of preventing soil erosion by stabilising the hillsides with trees -- and by discreetly pointing out the benefits of tree planting under Brazil's forest laws.
By getting certification that they are preserving 20 percent of their land, the hilltops and a 15-metre (50-feet) strip alongside river banks, landowners gain access to government subsidies and bank loans.
ITPA has received commitments of 11 million reals ($5.5 million), mostly from corporations, said Ruiz's deputy, Juliana Bustamante. "They have to reforest five hectares of land for every hectare of native forest they want to cut down," she said. Other contributions come from NGOs, including The Nature Conservancy in the United States, but "very little" comes from the government, she said.
Eventually, the replanted hills could save Rio a lot of money. The city pays a billion reals ($500 million) a year to remove silt from its water supply that pours down from eroded hills, said Bustamante.
But the dazzling species richness of before is impossible to recover.
"You never get it back," said Victor Hugo Inchausty, an expert with the International Union for Conservation of Nature (IUCN).