Rio de Janeiro, Brazil (CNN) -- Cement-block walls are being built around the shantytowns of Rio de Janeiro. Authorities say it's to save rainforests. The city's poorest residents say it's an attempt to shut them out.
When Francisco de Moraes looks at the wall, it angers him. He has one of the best views of Rio, overlooking the city, its shimmering beaches and Sugarloaf Mountain jutting from the sea.
"We don't have the right to have our opinion heard," he said.
He speaks during a break from a soccer game on a makeshift cement field that's wedged in by the wall. The "eco-wall," as officials call it, runs up next to his house and around most of the Santa Marta shantytown where he and about 7,000 others live.
"The state government walled us in, so more houses wouldn't be built in the forest," de Moraes said. "But people felt imprisoned, like they were setting borders and limiting when we could come and go."
The state of Rio de Janeiro began building the wall around Santa Marta in March, and it plans to spend $17 million on similar walls around the shantytowns.
There are nearly 1,000 such favelas -- cramped poor communities built around the city. The squalid homes tilt from their shaky foundations, some built on top of others. Many are carved into the humid rainforest that cling to the hillsides.
It's estimated about 20 percent of Rio's 6 million people live in the shantytowns.
Icaro Moreno, director of Rio state's public works, says the walls are necessary because the favelas have continued to expand by 7 percent over the last decade, making them one of the biggest causes of deforestation in the state.
"The limits used to be virtual and now they're physical," he told reporters at a news conference. "The government is saying, 'If you cross them or break them, you will be violating public property.' "
Some residents feel officials are keen to rein in the expansion of Rio's chaotic slums ahead of the 2016 Olympics. The naked cement and brick homes of the shantytowns can be spotted from beaches. Locals feel the city's elite are trying to wall off an eyesore.
"They treat the people here like children who need to be corralled in," said Eliane Lopes, who runs her own party-organizing business in Santa Marta. "We can respect limits as well as the rich people. We don't need a wall."
Founded by squatters looking for work in the big city, shantytowns like Santa Marta are not even on most maps. Critics see the wall as a barrier between crime-ridden slums and beachside condos rather than an effort to protect the forest.
But not everyone in Santa Marta opposes the wall. Jiuzel has lived here for 34 years and he's seen the population explode in size, more than double what it was in the 1970s.
He says an increased police presence and investments in projects like the wall and a funicular (cable car on rails) linking the steep slum to the rest of the city shows that officials are trying to improve their standard of living.
"People are pleased because it's going to protect the Atlantic Forest. Protecting the environment is important," he said from his balcony overlooking the forest.
The Atlantic Forest blanketed much of Brazil's coast when Portuguese adventurers landed here 500 years ago. According to experts, the humid rainforest was home to more plant and animal species than the Amazon. Only 7 percent of the original forest is left.
In Rio, the plan is to build about 9 miles (14 km) of walls around 13 favelas in danger of eroding the jungle further.
Critics have drawn parallels to the Berlin Wall or the barriers that separate Israel from Palestinian territory.
Fernando Gabeira, a senator from Brazil's Green Party, disagrees.
"This wall is not a wall like the Berlin wall," he says. "Everyone may pass. There is no control trying to avoid people visiting the community or leaving the community."
But, he says, he recommended introducing a satellite tracking system to prevent the expansion of favelas, instead of building a physical barrier.
"It's the difference between soft power and hard power."