SACRAMENTO, Calif. (AP) _ More than 1,200 inmates who live by a brutal code of each man for himself in prison stood together Friday as trained firefighters against Southern California blazes that had killed one of them.

Despite the danger, the inmates say they prefer the job over the alternative.

''It's better than doing time behind the wall. You eat better; it's less violent. There are better surroundings,'' said inmate firefighter William R. Marcott.

On Wednesday, 16 inmates were overrun by a wildfire in Riverside County. Victor F. Ferrara, 22, serving time for assault with a deadly weapon, died Thursday night at a San Bernardino hospital, said state prison spokesman Tip Kindel. Four remain hospitalized, one in critical condition.

In Arizona, a blaze Tuesday killed five inmate firefighters and a supervisor.

''Hearing about the others makes you wonder. It scares you. Getting killed crosses your mind, especially when you go on a big-campaign fire,'' said Marcott, 30, who is serving time at Green Valley Conservation Camp near Sacramento for assault with a deadly weapon.

Marcott fought a Los Padres National Forest fire last year during which an inmate firefighter was killed, the first fatality in the California inmate firefighting program since it began in 1946.

The state prison system and the state Department of Forestry and Fire Protection jointly operate the program.

''It's one of the most highly praised programs. It gives inmates the chance to pay something back to the community,'' said Department of Corrections spokeswoman Christine May.

The inmates also benefit ''by developing an esprit de corps that they've never had before, except maybe in gangs,'' said Lt. D.M. Reynolds, a program spokesman. ''They become a team. It teaches them the work ethic.''

The 1,200 inmates on the fire lines Friday are among 3,700 who are housed at 40 conservation camps throughout the state, where they do other manual labor when not fighting fires. About 300 of the inmates are women who work in segregated crews.

''It's a less structured environment,'' May said. ''We call the camps prisons without walls.''

The inmates in the camp program, about half of them volunteers, are screened to be sure they are physically fit and not likely to flee, and are given four weeks of classroom and field training.

Most have 30 months or less to serve on their sentences, and receive one day off their terms for each day they work. They also earn $1 an hour for battling fires.

Supervised by unarmed state firefighters, they can spend days or weeks on the fire lines, working in 12- or 24-hour shifts with hand tools, back pumps, and chain saws.

''You hike in miles on foot sometimes and once you're there, it's a lot of work with hand tools,'' said Marcott. ''Sometimes you're far away from the fire and other times you're right there at the flames.''