LA PAZ, Bolivia - Inside the massive prison walls, a stairway led to the roof where a girl in pink and three other children played with an improvised toy, a big blue barrel.
A man in a black hoodie walked by the children, glancing around cautiously before heading to a corner lined with mattresses. He pulled something from his sock, turned away and lifted his arm to his face. It looked to me like he was doing drugs. The children went on playing inside the blue barrel. They had nowhere else to go—and no way out.
These children spend many of their nights alongside drug dealers, thieves, and other criminals at the notorious San Pedro Prison in La Paz.
More than 500 children in Bolivia live with imprisoned parents and other relatives.
Jorge Lopez, the country's chief of prisons, concedes it's not an ideal environment for children.
"I reiterate, jail is not the best place for children to grow up, but neither can we promote separation from their families," Lopez told reporters in December.
The good news, he said, is that the government had reduced the number of children living in prison from up to 1,700 in 1995 to about 550.
Officials at San Pedro declined to grant any interviews and would not let me inside the jail, which is more than 130 years old. The best I could do was look down on the prison from a nearby rooftop and that's when I saw the suspicious scene.
Before traveling to Bolivia, I had watched YouTube videos that backpackers had shot inside San Pedro. I learned that an English-speaking inmate and convicted drug trafficker named Thomas McFadden used to give tours to cash-toting tourists.
An Australian journalist, Rusty Young, bribed guards so he could live for three months inside the prison. He and McFadden wrote a later book about their experiences. "Marching Powder," published in 2004, revealed that prisoners, not guards, were in charge of San Pedro. They produced cocaine and sold jail cells as if they were real estate plots. Rich inmates lived in luxury while the poor endured violence and hardship. And women and children lived among them.
Inmates continued offering tours after McFadden was freed in 2000 and even Lonely Planet touted the unusual jail visits.
In 2013, Bolivian newspapers reported that a 12-year-old girl had been raped in San Pedro. There were conflicting accounts about what happened, and prison officials denied the story. The tours evidently ended in around 2014.
I pressed hard to get inside the prison, but an official pushed back. San Pedro wasn't a tourist attraction, he told me. It was a place where inmates were punished for their crimes. And he said I couldn't go inside.
Days later I traveled to central Bolivia. I spoke to a mother of four whose husband, Ariel, has been at San Sebastian Prison in Cochabamba since 2014.
I met Claudia Cossio at Casa de la Amistad, or House of Friendship, a Christian center where inmates' children played and ate snacks.
Cossio said her children visit their father on weekends. She was glad they had contact with him, but said jail was no place for young people.
"I don't think it's good for our children," she said. "Instead of being in a prison, our children should be involved in other activities for them. Something good, something fun."
Cossio said authorities jailed her husband in 2004. They accused him of raping a 9-year-old relative.
Cossio said she doesn't believe the charges. She said a relative got into some sort of dispute with her husband and paid a medical examiner to say that the girl was raped.
"The innocent pay the price," she said. "They're in jail. People who are hurting society run around free. They put people in jail who have nothing to do with it."
She had one child, a girl, before her husband's jailing in 2004. Since then, they have had three more children.
Cossio is allowed conjugal visits and sees her husband three times a week.
She said visits are sometimes humiliating because she is usually strip searched.
"They treat us badly," she said. "We have to get undressed. We have to take off our clothes, pull down our underwear. That's how the inspections are. We have to do that."
Cossio said trying to have some intimate moments with her husband is "very uncomfortable."
"We have to cover up with a sheet, a curtain so we can have some privacy," she said.
Then when it rains, water comes pouring through the roof, forcing many inmates to drag their mattresses to any dry spot they can find.
"Every time it rains, it rains inside and it rains outside," she said.
Her husband is from Argentina. He is scheduled to be released in about a year.
"He doesn't want to have anything more to do with Bolivia, above all because of the injustice that there is. He said, 'I'm getting out and I'm not going back.'"
He plans to return to Argentina and Cossio said she and the children will go with him.
"What I know is that I trust my husband," she said.
All her children want is a normal family life.
"When they are outside, the children go to parks. They see other children with their parents. They're with their mother and father and our children feel bad. Our children are only with their mom and not with the dad. They always ask us, 'One day when dad comes out, can we go with him to the park and go for a walk?' As a mother, you feel bad hearing your children say that."
Bolivian officials have known for years that living in jail can disrupt a child's development. Children in prison often trivialize the seriousness of their parents' offenses, according to a 2005 Bolivian government report.
"He loses fear of prison and prepares to be a delinquent adult, without fear of the punishment he has internalized as a way of life," the report said. "Their experiences are reduced to the prison yard."
Officials have made strides in Cochabamba, reducing the number of children in prisons from 800 at the end of 2016 to just 41, according to Jorge Fernandez, a Cochabamba journalist who has interviewed women in prison.
"We've spoken to the mothers," he said. "Most say it's preferable that their minor children are with them. They know how they are doing, if they are eating or not, despite all the discomforts there may be in prison."
Church volunteers who work with their children say some of them develop low self-esteem. Or they become violent.
Many have seen fights and attacks in prison. They see inmates doing drugs. They've heard them talking about sex.
"They live in tension," said Alex Villarroel, 67, who leads a weekend recreational program for young people in Cochabamba.
Nearby, children played soccer on a basketball court. Some had come from San Sebastian prison, which was built for 250 people in 1935. Now it's jammed with more than 1,000 inmates and it has no playground, Villarroel said.
"Soccer, jumping around, it's part of letting off steam," he said.
Some children sleep at the jail. Others are only allowed to visit for two hours.
Villarroel, pastor at the Villa Galindo Baptist Church, said he's learned that prison doesn't always rehabilitate a person. He recalled the story of one parent who was clean when he went to jail, then started using drugs while behind bars.
"The father has more problems because now he's a drug addict. He became a user in prison," the pastor said.
Drug use is common in prison, Villarroel said.
He said one boy who came to his church only wanted to sleep. He quickly discovered that the boy was living in prison with only plywood and flimsy curtains separating him from drug users. So he had been breathing noxious fumes and it affected his behavior.
More than anything, Villarroel said, these children need "love, affection."
"They call us their aunts and uncles," he said. "We're part of their family."