MEXICO CITY  Beyond the high concrete walls and menacing guard towers of the Santa Martha Acatitla prison, past the barbed wire, past the iron gates, past the armed guards in black commando garb, sits a nursery school with brightly painted walls, piles of toys and a jungle gym.

Fifty-three children under the age of 6 live inside the prison with their mothers, who are serving sentences for crimes from drug dealing to kidnapping to homicide. Mothers dressed in prison blue, many with tattoos, carry babies on their hips around the exercise yard. Others lead toddlers and kindergartners by the hand, play with them in the dust or bounce them on their knees on prison benches.

Karina Rendón, a 23-year-old serving time for drug dealing, said her 2-year-old daughter thought of the 144-square-foot cell she shared with two other mothers and their children as home. “She doesn’t know it is a prison,” she said, smiling sadly. “She thinks it’s her house.”

While a prison may seem an unhealthy place for a child, in the early 1990s the Mexico City government decided it was better for children born in prison to stay with their mothers until they were 6 rather than to be turned over to relatives or foster parents. The children are allowed to leave on weekends and holidays to visit relatives.