-- In a dank workshop where the din of pounding hammers bounces off cement walls, Rosangela Oliveira, a convicted drug runner, screws locks together at a factory inside the Tatuape Women's Prison.

The 29-year-old mother of six is one of 42,000 prisoners working in hundreds of jailhouse factories that Brazil's most populous state, Sao Paulo, has set up with private companies.

It hopes that giving inmates job skills will end a cycle of poverty and crime where six out of every 10 released convicts return to prison.

Unions, however, worry that the state is killing off good jobs by offering companies a way to avoid paying costly pension and health benefits. Moving a job into a prison can cut costs in half and erode job security in the formal labor market.

Prisoners, who usually earn a monthly minimum wage equivalent to $135, say jobs keep them away from jailhouse violence and help them support families on the outside. Still, they fear bias against ex-convicts will prevent them from getting jobs after leaving prison.

"We sell prison labor," said Marcio Martinelli, director of the state office for prisoner education and assistance.

A marketing executive from the private sector, Martinelli was hired in March and wants to find jobs for nearly all the state's 117,000 convicts.

He tells companies that opening prison workshops is socially responsible and can offer inmates, many of whom were poorly educated in public schools, a path out of crime.

"The problem of the prisoner is a social one and if you don't employ him now, he will be out of jail tomorrow, and if he isn't employed when he leaves prison then we will return to crime," Martinelli said.

He has focused on finding skilled work for prisoners, such as furniture making and metalworking, instead of the traditional prison job of sewing professional soccer balls.

Brazilian law has long guaranteed prisoners the option to work and earn at least two-thirds the monthly minimum wage, though most companies pay more than this. The state does not receive any money from the companies.

But Sao Paulo, which houses more than a third of the country's inmates, is emphasizing jobs as part of a broader restructuring of its penal system.

In 2002, it demolished Carandiru, Latin America's largest prison, to end years of bloody revolts, including a massacre of 111 rioting prisoners by police in 1992.

Since closing Carandiru, the state has built dozens of small-scale prisons in small towns in its vast agricultural interior. Jobs in the new prisons now threaten to alter local economies.

"Companies that use prison labor in a nasty way to cut costs are engaging in unfair competition," said Osvaldo Ansarah, a lawyer for a statewide federation of metalworkers, who traditionally have the best-paying manufacturing jobs.

"Companies should use prison labor only to complement their work forces, not to replace them," he added.

Some unions want a law passed to prevent companies from having inmates make up more than a small proportion of their workforce, say 10 percent. When the state acts as a broker for prison jobs lacking benefits and safety protections, it could hurt workers in the rest of the labor market, they argue.

"We need to avoid outsourcing, informality and temporary work," Ansarah said.

Prison jobs in Sao Paulo have grown 35 percent over the last five years, a period in which Brazil's economy was stagnant, union power waned and U.S.-style outsourcing grew rapidly.

Martinelli, of the state's prisoner training office, said he understood the concerns of unions but argued that building a better society requires giving prisoners marketable skills.

Employers of prisoners say they are pleased with the experiment. Shop floor supervisors say working alongside prisoners has allowed them to see inmates as people instead of faceless criminals.

Still, Oliveira, the convicted drug trafficker who puts together locks for the Alianca company, fears that even with new skills she will have a hard time finding a job.

"There's a small chance I can get a job with this company when I get out of jail, but there's a lot of prejudice against ex-cons, and nobody will want to hire someone like me with a tattoo on their neck," she said.

Brazilian prisoners operate metal lathes in a factory set up inside Sao Paolo's Tatuape prison, where inmates work for private companies in exchange for minimum wage and a chance to support families on the outside.