California inmates are fighting on the front lines to contain raging wildfires, all while state leaders secretly worked to keep them imprisoned and fighting fires for little to no cost.

In recent weeks, parts of the drought-stricken state have ravaged by wildfires, leaving at least 34 people dead and forcing some 20,000 residents to evacuate. The flames have charred over 190,000 acres of land and damaged and/or destroyed around 3,500 structures.

Among those battling the blazes are 3,800 inmates, both men and women, who make up 13 percent of California’s firefighting force and whose cheap labor saves taxpayers $124 million per year, according to the California Department of Corrections and Rehabilitation. Working on salaries of just $2 a day and an extra $1 per hour for their time on a fire line, inmates earn next to nothing for their work, compared to civilian firefighters who have a starting salary of $40,000 per year.

Some have compared the work to slave labor.

“The pay is ridiculous,” La’Sonya Edwards, a female inmate who battles blazes in Southern California, told The New York Times in August. “There are some days we are worn down to the core — and this isn’t that different from slave conditions. We need to get paid more for what we do.”

Former mayor of Richmond, Calif., and lieutenant governor candidate Gayle McLaughlin agreed, telling NBC News, “No matter how you may want to dress it up, if you have people working for nothing or almost nothing, you’ve got slave labor, and it is not acceptable.”

Using prison labor to battle blazes is nothing new for the Golden State, however. A recent New York Times report said the state has been employing inmates to fight fires during fire season since the mid-19th century. In 2014, the federal court system began talks to shrink California’s inmate population of almost 115,000 men and women.

State leaders hesitated on the plans, however, because inmates (including those who are eligible for release) serve as a cheap, yet critical source of labor as firefighters.

Lawyers from the office of then-Attorney General Kamala Harris argued that releasing too many inmates “at this time would severely impact fire camp participation — a dangerous outcome while California is in the middle of a difficult fire season and severe drought.” Harris, who now represents California in the U.S. Senate, told Buzzfeed News she was shocked upon hearing her attorneys’ reasoning.

Her office’s argument was one recently echoed by Louisiana Caddo Parish Police Chief Steve Prator, who was upset over the release of “good,” nonviolent inmates “you could work — the ones who can pick up trash.”

“I don’t want state prisoners, [but] they’re a necessary evil to keep the doors open, that we keep a few,” Prator said during a news conference, drawing immediate backlash from critics who said his comments evoked slavery.

As for the fire program, it should be noted that the work is voluntary and not everyone has an issue with it. For Sandra Welsh, an inmate working at Malibu Conservation Camp #13 in Southern California, joining the program was a decision she made for the sake of her two kids.

“This prison trip has taken a lot out of their lives and I wanted them to have something to hold onto,” Welsh told NBC News.”My mom’s a firefighter. I might be an inmate firefighter, but I’m a firefighter.”

The program also offers other incentives, like being housed in a camp rather than the confines of a prison cell, and the ability to earn two days off their sentence for each day they’re in the fire camp.

Melissa Logan, an inmate also at the Malibu camp, described the work as empowering and rewarding because she helps save people’s homes. Fellow inmate LaToya Najar agreed and said fighting fires helps them better themselves both physically and mentally.

Despite the perks, there’s no doubt that what these inmates do is dangerous work. One of the Malibu camp inmates, Shawna Lynn Jones, died working on a fire with her crew in February 2016. In her four months as a firefighter, Jones only made $1,000, her mom told the newspaper.

In May, one male inmate was crushed by a falling tree, while another inmate died two months later after accidentally cutting his leg and femoral artery on a chainsaw. Still, many inmates are willing to accept the risks and change their lives for the better.

“This is not a vocational program,” said Bill Sessa, spokesman for the Department of Corrections. “It is not designed to teach inmates how to be full-time firefighters. But they learn many life skills that they will say help them succeed in life when they leave prison … leadership, discipline, teamwork, responsibility.”