LIMA -- For years, life in her neighborhood was a wearying, endless run of sleepless nights from the screams of crime victims outside her door, Valeria Salazar recalls.
''It was horrible. All of a sudden at night, 'Ahhh! Ahhh!' We'd go outside and a person would be laid out on the ground," said the 50-year-old homemaker in Ate, a dusty, largely industrial district of Lima tucked at the base of the Andean foothills.
''You couldn't sleep on this street because every night people were being robbed."
Then, two years ago, she and her working-class neighbors decided to follow the lead of Lima's wealthy: They put up iron gates and shut off traffic on the public street through their block. Since then, ''We've had tranquillity," Salazar said.
Known in its modern heyday as the ''garden city," Lima is in danger of taking on a new moniker: the ''caged capital." More than 1,000 gates block public streets in neighborhoods across the city, rich and poor. And almost none of the barriers is authorized.
Augusto Ortiz de Zevallos, an architect and urban planner, says the gates are an unfortunate reality.
''They signify surrendering the idea of public space, and accepting a definition of city as ghettos of rich and poor," he said.
The gates have brought increased safety risks, municipal officials warn. They say it's harder to respond to fires and other emergencies, particularly when many poor neighborhoods that cannot afford 24-hour gatekeepers padlock themselves in for much of the night.
''There are neighborhoods completely closed, under lock and key," said Juan Carlos Zureck, president of the Urban Transport Commission. ''It could be a deadly situation we'll later regret."
Fire Chief Tulio Nicolini says ambulance and fire truck drivers -- as opposed to criminals cruising for potential victims -- often find themselves navigating an impenetrable labyrinth.
''We always have to search for a place to enter," he said. ''Firefighters can't respond quickly and then we are stuck turning heavy trucks and ambulances on tiny streets."
Seeking to bring some semblance of order, officials issued new rules in September governing gated neighborhoods. They were given until year's end to hire round-the-clock guards to allow traffic to pass. And civil defense authorities will have to be shown that at least 80 percent of a district's residents approve of its gates, or else they must be torn down.
Failure to abide by the rules also will be punishable by a fine of 2,480 soles, or about $740. For average Peruvians, most of whom earn the monthly minimum wage of around 460 soles, about $137, or less, that would be a significant bite.
But it remains to be seen how the new rules will be enforced. Public safety codes are handled by district municipalities within greater Lima, and are generally taken more seriously by richer neighborhoods, not the poorer ones where violations are the most flagrant.
The phenomenon of gated streets arose from three decades of lightning-fast growth, with hardly any urban planning, that has drastically transformed this once regal capital.
Since 1970, the migration of Quechua-speaking Indians and mixed-race highlanders has helped balloon Lima's population from under 3 million inhabitants to 8 million.
The historic center, where flower-filled plazas and immaculate sidewalks were once the exclusive domain of the white elite, was abandoned to decay while poor neighborhoods and shantytowns sprouted around expanded suburban enclaves.
Wealthy districts, particularly La Molina and Surco, started to enclose subdivisions of colonial-style chalets and boxy modern townhouses built around manicured parks in the 1980s when the Maoist rebels of the Shining Path movement began encroaching into the city from the countryside.
The political violence dropped off after the 1992 capture of Shining Path founder Abimael Guzman in a Lima safe house, but rising crime has remained a serious problem. Poorer districts began putting up their own gates in the last five years in response to the inability of Lima's cash-strapped, understaffed police force to cope.
''There's a deep sense here, above all, that the state is incapable of providing the protection that it should, and so in a way they are organizing spontaneously to create their own small private states," said psychologist Jorge Bruce.
''The gates are a symptom not only of the lack of security but of the enormous deficiencies of legal authority to protect the population."