From the outside, the sprawling complex with manicured lawns, a swimming pool, a basketball court and a soccer field could easily have passed for a summer camp. Only the riot troops on patrol hinted at the world inside.

For years, the Imigrantes detention center for juvenile offenders concealed a vicious world of systematic beatings and dirty, crowded living quarters. But the facade crumbled after a wave of deadly riots and mass escapes this year forced the Sao Paulo state government to shut the complex.

Hundreds of young inmates were bused away early this month, but the memories of brutality are not so easily erased. Charred and silent, Imigrantes remains a symbol of how Brazil treats its wayward children.

"When we are released, or run away, all we want is to get even," said one former inmate.

Like other such centers run by the Sao Paulo State Foundation for the Welfare of Minors, the stated purpose of Imigrantes was to rehabilitate youngsters, who should "be treated with respect and dignity" and "receive schooling and vocational training."

"If that were the case, this place would be like Disneyland. But this is hell," 16-year-old "P.S." said a few weeks before the complex was closed. Like other inmates, he cannot be identified because he is a minor.

Brazilians got a glimpse of that hell when riots exploded at Imigrantes and other juvenile centers, known collectively as Febems. An estimated 1,500 youths escaped, and only about 500 were recaptured.

The worst came on Oct. 24, when more than 1,000 youths seized control of Imigrantes and went on a 19-hour rampage. The country watched in horror as television showed a group of teenagers beating and kicking a smaller youth of about 12 and threatening to throw him off a 20-foot wall if police tried to approach.

What viewers did not see was worse. Inside, at least four youngsters were beaten and then stabbed to death. Two were beheaded.

"Imagine how you would kill a rat," said Roberto Brasil, a guard who was held hostage for 11 hours and witnessed the killings. "They were beaten to a pulp, beyond recognition. I can't even describe what it's like."

But the public also heard from young inmates who told of frequent beatings by guards and filthy, crowded conditions. Their tales debunked a common belief that conditions at Brazil's juvenile centers were better than those at the country's notoriously awful adult prisons.

In September, P.S. took part in a mass escape from the Imigrantes unit, which held 1,100 youths in facilities built for 350. After he was recaptured, P.S. described what happened.

"As soon as the cops brought us in, we were slapped around and beaten with pieces of wood and iron wrapped in towels," he said, pointing to bruises on his arms and legs and stitches on his head.

The youths were stripped to their underwear and forced to sit on the cold concrete floor for hours with their arms wrapped around their legs, said P.S., who is serving time for armed robbery.

"If we dared open our mouths or move an inch, we were beaten or forced to stand against a wall on tiptoe for long periods while the guards punched us in the ribs," added another inmate, 17-year-old P.G. "We couldn't even ask to go to the bathroom."

Antonio Gilberto da Silva, president of the Union of Febem Guards, said violence is used only to quell uprisings. However, he admitted, some guards "lose control." But he said the detainees, despite their youth, are very dangerous.

"If they can, they will kill you, because you are the only thing standing in the way of what they want most, which is to escape," da Silva said in an interview with the newsmagazine Veja.

P.S. and P.G. said the beatings took place at the screening center where detainees are held for up to three months before sentencing. Afterward, they are sent to the "educational units," where treatment is less harsh.

Access to the screening center was denied. But the Teotonio Vilela Human Rights Commission, a nongovernmental organization whose representatives toured the center, described it as a pigsty "where adolescents are routinely submitted to physical and psychological violence."

"Children and adolescents under the guardianship of the state are being treated like animals," said Paulo Sergio Pinheiro, the commission's coordinator. "It's no wonder they rebel and try to break out. It's their way of calling attention to the hell they live in."

Archbishop Claudio Hummes of Sao Paulo also visited Imigrantes and saw a tiny room that he was told served as sleeping quarters for 13 to 15 youths.

"The only way they could fit would be on top of each other," Hummes said. "The big problem now is space, where to put them all. Something must be done or it will just happen again."

In early October, Mario Covas, the state governor, ordered a complete overhaul of the Febem system. Wardens were replaced, and many guards were suspended or fired.

The new directors promised improvements, rehabilitation and an end to the brutality.

"Animals in the zoo were being treated better than these youths," said Guido Antonio Andrade, who took over as Febem's president.

He pledged to do away with large detention centers in big cities and build smaller units around the state, invest in vocational training and hire more humane guards. But days after the Oct. 24 riot, Andrade resigned, citing personal reasons.

Covas said Andrade's ideas would be carried out.

CAPTION: Youths at Imigrantes juvenile detention center demonstrate how they were forced to sit for hours after a recent uprising.

CAPTION: Mounted Brazilian riot police keep watch over a soccer game inside the detention center, which hid a world of systematic violence and dirty, crowded conditions.

CAPTION: Some of the youths who escaped are taken back to the center, where, one said, they were then beaten "with pieces of wood and iron wrapped in towels."