When residents of Rio de Janeiro's mammoth Rocinha slum heard of government plans to build a wall around parts of their community, opposition to the idea quickly mounted.

The wall would be an "ecobarrier" aimed at curbing the unchecked and damaging expansion of the favela slums into Rio's lush tropical forest, state officials told them.

But in the Brazilian city tainted by inequality and violence and sharply divided between hillside slum dwellers and middle-class residents, many in Rocinha saw something more sinister in the plan for three-metre-high barrier.

"The wall represents a ghetto, an apartheid, the end of the communication between people, so we started to fight against the wall," said Antonio Ferreira de Mello, the head of a Rocinha residents' association. "There are other ways to prevent the growth of favelas into the forest."

Fierce opposition in Rocinha forced officials to scale back the planned wall there, but plans are in place to build more than 14 kilometres of walls around Rocinha and the other 12 slums identified as endangering nearby forests.

Construction began in March on one section and so far a few hundred metres has been completed.

Critics have drawn parallels with the Berlin and Israel-Palestine walls, saying it is the latest step in a security policy that criminalizes the slum dwellers who make up about a fifth of Rio's population of six million.

Brazil's Secretary of Human Rights Paulo Vannuchi said that "the idea of a wall is never a good idea."

Some argue environmental concerns are masking the government's security agenda and lack of a coherent policy to contain the rapid expansion of Rio's favelas in recent years.

The population of Rio's slums grew by nearly a quarter from 1991 to a little over one million in 2000, the latest data available from the IBGE national statistics office showed.

"The fundamental issues of these communities will never be resolved through walls. To the contrary, the issues will only be resolved through the slum's integration into the city," said Jorge Luiz Barbosa, a professor at Fluminense Federal University who also heads a favela support group.

Many of Rio's hundreds of slums are controlled by heavily armed drug gangs that have further alienated them from the rest of the beach-side city. Despite regular, violent raids on slums, police have largely failed to bring them under control. The city's forest is sometimes used by gangs as a refuge and as a training ground, adding to suspicions that security is the main reason for the walls.

Recommendations by some officials in 2004 to build walls for security purposes triggered a public outcry.

The choice of location for the walls has also raised some eyebrows. Of the 13 communities, 12 are in the wealthy southern district, home to the city's glitziest homes, restaurants and its famous beaches. Walls are only planned for one community in the city's western zone, even though analysts say those slums are expanding at an even faster pace.

"All of this contributed to at least the suspicion that there is a public security agenda that is very different from the environmental agenda," said Ignacio Cano, a sociologist and professor at University of the State of Rio de Janeiro.

Officials are keen to spruce up Rio's unruly image and tackle its crime problems as it prepares to be a host city for the 2014 World Cup and campaigns for the 2016 Olympics.

But they are adamant that the walls are purely aimed at protecting the forest, which by last year had shrunk to 18 per cent of its original size, according to environment group SOS Mata Atlantica.

Comparisons to Berlin or Israel are ridiculous, they say.

"There was never an intention to put anyone in a ghetto or to separate. That doesn't exist," said Icaro Moreno Junior, head of Rio state's public works company.

"What's the function of the wall around your house, my house, all houses? The function is to define limits. Up to here you can grow, beyond is the forest."

Experts say the root problem is a severe housing shortage affecting Rio and the whole of Brazil.

Under the government's flagship infrastructure program, known by the Portuguese acronym PAC, the federal authorities plan to build some 3,616 homes in four different Rio slums, according to Rio's secretary of public works.

The government also announced a 34 billion reais ($17.3 billion) housing plan for low-income families in the country in March, aiming to build one million homes by 2011.

But critics say they are a drop in the bucket in a country with a 7.2 million deficit of houses and a population that is estimated at more than 190 million people, up from 169.8 million in 2000.

They say there is little political will, either locally or nationally, for a more comprehensive approach - a housing policy that would provide alternatives to more construction in the slums.

"We haven't had a housing policy in Rio for decades," said Cano. "Social inclusion needs a level of economic, social and political investment that doesn't exist nowadays. We also have unfortunately a ... political system where these slums have no political representation."

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.