An inmate who was learning to fight California’s wildfires was killed by a guard Sunday during a riot at the prison where he was being trained, officials said this week.

Jonathan Velarde, 23, was in the thick of a 45-person riot that broke out in the mess hall at California Correctional Center-Susanville, officials said. Velarde stabbed other inmates and was himself stabbed, officials said. A guard fatally shot him with a rifle.

The riot and Velarde’s death indicate that the problems of gang violence and overcrowding in California’s prisons, which have been mounting in recent weeks, extend to low and medium-security facilities, such as CCC-Susanville, where firefighters are housed and trained.

As the state of California enters its fourth year of record-breaking drought, parched forests are erupting in flames. So far in 2015, at least 4,382 wildfires have razed over 117,960 acres of woods, threatening thousands of homes and contributing to Gov. Jerry Brown’s unprecedented decision to restrict the amount of water Californians can use.

California employs about 6,000 professionals to fight its many wildfires. But because that’s not nearly enough to do the job, the state also assigns 4,000 prison inmates to work in the fire camps, clearing out brush and battling 50-foot-high flames.

The inmates “are not the ones up in the helicopters” dumping fire retardant, says Bill Sessa, a spokesperson for the Department of Corrections and Rehabilitation. “But they’re in the thick of it, cutting fire lines and helping to save large areas of California.”

Because these inmate-firefighters, some of whom are juveniles, are paid only $2 a day, they save the state about $80 million every year. Their labor is so economical, in fact, that after the Supreme Court ordered California to reduce the dangerous overcrowding in its prisons, the state’s Deputy Attorney General argued in court against releasing too many inmates — because doing so “would severely impact fire camp participation, a dangerous outcome while California is in the middle of a difficult fire season and severe drought.”

Jacques D’Elia, 49, a former California inmate who battled fires at Valley View Conservation Camp in the Mendocino National Forest from February 2011 through November 2013, knows that he was used for very dangerous labor. D’Elia, who was incarcerated for five years for counterfeiting and drug-related charges, also says that working at the fire camps was “an honor and a privilege,” an opportunity to prove himself and stay sober — and a whole lot better than prison.

Below, the experience in his own words, edited for length and clarity.

What had you heard about the fire camps from other inmates?

The fire camps were so popular with inmates — everybody was trying to be on good behavior so that they could be eligible to go.

I also heard from people that it would be easier to get visits from your family once you were at the camps, because the camps didn’t have any barbed wire, no concrete. Your family could just drive there, if they had a car, and visit you.

What did you have to do to make it into the program? What did you have to do to physically prepare for firefighting?

You had to be a low-security type of inmate to begin with, or if you were higher security you had to work your way down the security levels — by not getting in any fights, participating in programs, that kind of thing. For a lot of inmates, it took years before they earned the privilege of going to the camps.

Then they checked your physical fitness and mental health, and the physical fitness was hard for me because at that point, I was 45. You had to prove you could carry 100 pounds of gear in brutal heat.

When you got to the camp, how did it compare to being in prison?

I forgot I was incarcerated sometimes. The staff treated you like a human, not a number. The boundaries were more relaxed — just a split-rail fence and some out-of-bounds markers, no locks on the doors. All they did was do a “count” of everyone every two hours.

You were just out there in these beautiful woods, with deer, wolves, bobcats. You had views across the valley at sunrise, out over 100 miles of the Sierra Nevada mountains — which really changes your outlook from when you were in prison.

Did the inmates behave the same way they did in prison?

I’d say it was a way more liberal place, with way less of the prison politics. At the camp, everyone wasn’t segregated by race, like it was in prison. And the power dynamics and the violence you see on the prison yard, the ‘survival of the fittest’ stuff — that was hardly there at all.

There were enough of the tough guys there that I had thought the same politics would still hold true, but I learned that fewer total men, plus more freedom for those men, equals a safer place than an overcrowded yard.

You’re still counting down the days until you go home; it’s not like you want to stay there. But fighting fires, man, that is so much safer than being in prison.

What was the process for fighting a fire?

At base camp, we would be in a tent city for inmates, which was separated from where the professional firefighters were sleeping.

We were told to eat 5,000 calories a day because of the physical exhaustion that we were going to face.

Then they helicopter you up the mountain to the fire, give you your fire orders.

The Record The best criminal justice reporting from around the web, organized by subject

And then for a whole day at a time, you’re cutting a fire line to block the path of the fire. First you go through with chainsaws and remove an eight-foot wide path of trees and plants; then you come through with axes, knocking out the stumps; then the hoes; then there’s a guy at the end of the line with a wire brush to rub away everything else that could catch fire.

You’re working hard like that for 18 hours at a time, and you go for miles and miles through the woods, making this path that the fire can’t leap across.

And fighting the fires — what was that actually like?

It’s a hairy adventure, let me tell you. You’re an inmate and you have to do what they say, scary as it is, or else you’re going to get sent back to prison. So they throw you into the worst of it.

I’d sometimes be about 10 feet from these flames that were 40- or 50-feet high, and debris and branches were falling everywhere. You’re carrying 45 pounds of gear. A few times I got engulfed in flames, and even though I had all this gear on, it immediately wicked every drop of sweat off my body and I was dehydrated in about one second.

I saw guys fall off cliffs and get pretty injured, chainsaw injuries, burns, heat stroke.

It was so physically demanding — but I have to say, it was an honor, a privilege, and a gift to be doing it. Every day, we wanted to prove we were better than the professional firefighters who were there. And it made me understand how much good I could do and how proud of myself I could be at the end of the day, which never happened in prison.

Did anyone ever try to escape?

Yeah, definitely. Some guys try. They run out into the woods. But then the camp gets locked down, and the C.O.’s always hunt them down.

Looking back on it, do you almost miss it?

I mean, I obviously wouldn’t go back to being an inmate.

But honestly, I truly believe that the fire camp saved my life. I had always struggled with drugs and alcohol, and I have been sober ever since that camp, which is partly because of AA but also because it made me appreciate myself, feel as though I had a purpose in me.