By Mark Gregory
BBC News, Niteroi, Brazil
Many societies agonise over issues surrounding crime and punishment. Prison often seems the only solution, but there is a danger that in the company of criminals an inmate will learn more about crime than they knew before. But that does not have to be the case.
Brazilian prisoners suffer from poor conditions and serious overcrowding
The Brazilian prisoner's lot is not a happy one.
Brazilian jails are notoriously old and overcrowded, sanitation is poor, abuse and gang violence are endemic. But there is little sympathy from the wider society.
Most Brazilians, beset by high and rising crime levels, think prisoners are only getting what they deserve.
As in other countries, inmates often come from broken homes. They have little education and few skills that could get them a regular job.
For many, crime is not a career choice, it is the only thing they know how to do.
Recently I met a man who has devoted his life to creating an alternative.
He works with prisoners and their families to provide the skills and support they need to earn a legitimate living and stay out of jail.
He is not the only person doing this, Brazil has plenty of projects at work in its prisons. But Ronaldo Monteiro comes at it from an unusual angle.
As a former inmate, he really does know the issues from the inside. He served 14 years of a 40-year jail sentence handed down for extortion and kidnapping.
But now he runs an organisation that teaches prisoners how to use computers and the internet, reflecting a particularly Brazilian obsession.
Kidnapping and ransoms
Brazilians are internet crazy. The average web user spends 70 hours a month online, although only a minority of people have computers at home.
There are more than 100,000 'Lan Houses' dotted around Brazil
Instead they go online at internet cafes, known locally as Lan Houses, which seem to be everywhere at least in the cities.
Social networking sites are hugely popular - only the market leader here is not Facebook, it is Orkut - a rival service owned by Google.
Ronaldo and I meet on a potholed street on a steep hill in a suburb of Rio de Janeiro.
He is an athletic-looking man, who at 52 years old seems a natural leader.
He tells me he was brought up right on this street, committed many of his crimes there and now wants to give something back to society.
I had never met anyone involved in kidnappings before, so I was intrigued to find out how he had got into crime and what had made him change.
Ronaldo Monteiro hopes computer skills can help others escape from crime
Ronaldo told me that unlike many people who have been through Brazilian jails, he came from a stable family.
His mother was a teacher, his father a truck driver. He had even had the chance to go to university but was distracted by the adrenalin rush and the money that came with crime.
It all started when he was 13 or 14 years old and he got into gambling.
Then he got into drugs and needed much more cash. That pushed him into more serious crime.
He claims he never killed anyone himself, but admits he did many terrible things.
Then he got caught.
His lawyer drew up a long list of his past crimes to show the judge. Reading it made Ronaldo think seriously about what he had done.
But it was the experience of being in prison that really made him change. He found religion, and - as he put it - learned to love himself for the first time.
It was only then that he began to care about others. He missed his daughters and that made him start trying to help the children and families of other prisoners.
His organisation grew from there.
A kindly warder gave him and other prisoners access to a computer, but was then nearly sacked when the authorities found out.
But Ronaldo can now reel off a list of former prisoners who have become computer experts and got good jobs.
His organisation is affiliated to the Centre for Digital Inclusion (CDI). It is a Brazilian charity that now operates in many countries, helping people improve their lives through access to technology.
His story is remarkable, but is his message getting across?
An institution for young offenders on the other side of Rio, where inmates are taught computer skills, is a good place to find out.
The instructor there is another former criminal, who says he served two terms in prison and would have been dead by now if he had stayed with his gang.
Now he looks confident and appears to relish being a role model for other kids from the shanty towns.
But two 16-year-old inmates at the centre are not so convinced.
One of them says he has learned how to turn a computer off and on, but he does not reckon that will be enough to get him a real job.
Ronaldo says it is the long-term inmates who value his courses the most of all. They at least finally know what terms like website and computer mouse mean, and can communicate with the kids they left behind in the outside world.
How to listen to: From our own Correspondent
Radio 4: Saturdays, 1130. Second weekly edition on Thursdays, 1100 (some weeks only)
World Service: See programme schedules
Story by story at the