Los Angeles courts force roughly 100,000 people to do weeks and even months of “community service” each year, exposing some of them to exploitative and hazardous working conditions without enjoying basic labor rights and protections, according to a first-of-its-kind study.

University of California, Los Angeles (UCLA) researchers analyzing court-mandated community service also found that government departments and not-for-profit organizations rely on workers threatened with debts and jail time to complete labor that would otherwise be paid – and that those affected are overwhelmingly people of color.

The UCLA Labor Center findings, released on Wednesday and shared with the Guardian, show:

People in LA county are ordered to perform an estimated total of 8m hours of unpaid work over a year, the equivalent of 4,900 paid jobs. Government agencies receive an estimated 3m hours of free labor, replacing 1,800 jobs.

People struggle to complete their work by imposed deadlines, and in criminal court, nearly one in five people sentenced to community service ultimately face a probation violation or arrest warrant as a result.

While community service is supposed to be an alternative to debt, most criminal defendants are still forced to make payments averaging $323. People also often have to “pay to work for free” through initial fees to receive their community service referrals, which can be more than $100.

In traffic court, which sentences people to community service for minor infractions, 89% of defendants are people of color.

The new paper, the first in-depth study of these kinds of sentences in the US, presents court-ordered service as a type of legal coercion and labor exploitation, comparable to wage theft. While community service has traditionally been considered a progressive alternative to imprisonment, in LA county, which has the largest jail system in the world, it’s a punishment that exacerbates inequality and creates an unregulated labor force where workers are vulnerable to abuse, the authors said.

A city worker cleans up trash on 20 November 2015 in Los Angeles. Defendants are frequently assigned to positions alongside paid workers. Photograph: David McNew/Getty Images

“There’s this invisible economy that is being produced out of the criminal justice system,” said Noah Zatz, a UCLA law professor. “Normally, it’s unconstitutional to threaten people with jail if they don’t work … This is a government-run system of extraction that is targeting communities of color and low-income communities.”

There’s been growing recognition of the unjust systems that send low-income people to jail because they can’t afford to pay municipal fines. Community service has received little scrutiny but operates in a similar manner by creating work mandates for people who can’t pay fees for traffic infractions or other offenses, Zatz said.

While defendants sentenced to labor are generally considered “volunteers” with few rights, they are also frequently assigned to positions alongside paid workers, sometimes manual labor such as graffiti removal, trash pickup and janitorial work. In LA, people most often work for places like CalTrans, the state transit agency, local parks and municipal departments, Goodwill, the Salvation Army and local community centers.

If they experience discrimination, sexual harassment, abuse, injuries or other forms of mistreatment on the job, they have few options, the researchers noted.

“Get to work or go to jail” is a looming threat, which means workers struggle to speak up, said Tia Koonse, the legal and policy research manager at the UCLA Labor Center. “It has a chilling effect on asking for accommodations, asking for a meal or bathroom break, asking for your rights.”

Spokespeople for LA county courts and a local agency involved in community service placement declined to comment.

Selena Lopez, 24, said she was forced to do service at a community center as punishment for a misdemeanor case in 2016. At the time, her father had been deported and her mother had died, and she was struggling with addiction, leading to minor run-ins with the law.

Selena Lopez had to complete more than 30 days of service, which forced her to put her education on hold. Photograph: Courtesy of Selena Lopez

She said she was trying to get back on her feet and finish school, but that the community service system derailed her. Then 21 years old, Lopez had to clean the kitchen at a not-for-profit organization and was surrounded by men who sexually harassed her, she said. The cleaning fluids she was using also made her sick, she said.

“I’m in a situation that is not good for my health, that is not safe for me,” she said, recalling that when she complained to supervisors, they threatened to revoke her hours or say she didn’t complete her mandatory service. “I had to choose – do I get this done, or walk away and lose everything?”

Lopez had to complete more than 30 days of service, which forced her to put her education on hold.

“Do I want to be in school or do I want to be in jail? I had this haunting me every day,” she said, adding, “Is community service doing good out here, or is it causing more harm?”

The UCLA report cited anecdotes of community service workers facing verbal and physical harassment harassment, with one saying “they treat people like trash”, and another reporting a male supervisor inappropriately touching women.

The authors recommend that the courts reduce the threats of jail and debt that force people into service jobs in the first place, noting that traffic stops and other policing of low-level offenses are plagued by racial profiling. They also support other sentencing alternatives that don’t rely on forced labor and argue that if punitive community service is used, it should lead to paid jobs and opportunities meant to help people.

Lopez, who is now studying communications and an advocate for the rights of incarcerated people, said people caught up in the system are “trying to make our wrongs right” and need support, not unpaid jobs. She said she hoped more people speak up: “I know I’m not the only one. There are so many people going through this.”