BAKERSFIELD, Calif. (CBS13/AP) — A judge in California ruled Friday that state prison guards who work in and around facilities’ health care settings must be vaccinated against the coronavirus.

Kern County Superior Court Judge Bernard Barmann’s ruling does not extend to all state prison employees, including guards who work in other settings.

READ MORE: Marta Kauffman, Co-Creator Of 'Friends,' 'Embarrassed' Now By Its Lack Of Diversity

The state Department of Public Health in August had ordered the guards, as well as other prison and jail employees who work in correctional health care settings, to get vaccinated.

The day before the deadline for shots last week, Barmann paused the state’s order for the guards, though not the other employees, as he considered arguments from the California Correctional Peace Officers Association against a vaccine mandate.

But the judge ultimately rejected the union’s arguments on Friday and denied them a preliminary injunction against the mandate, according to online court documents. The union can still appeal his decision.

“This is an unfortunate situation. We’re all dealing with this global pandemic which has gripped the planet for more than a year and a half now,” Barmann said, according to the newspaper’s report. “And the state of California is taking steps to address it, and unfortunately in the nature of such circumstances, something has to give.”

READ MORE: Experts: California Lacked Safeguards For Gun Owner Info

In a separate case, a federal judge last month ordered the state to mandate vaccines for all prison employees and incarcerated people who work outside facilities. Gov. Gavin Newsom, the California Department of Corrections and Rehabilitation and the correctional officers’ union are fighting the federal order.

Officials are trying to avoid an outbreak like the one that killed 28 inmates and a correctional officer at San Quentin State Prison last year.

As of Friday, 241 incarcerated people and 46 employees across the state prison system have died from COVID-19, according to data from the California Department of Corrections and Rehabilitation. The Sacramento Bee reports that 60% of state prison employees had been vaccinated by Oct.

Last week, the Sacramento City Unified School District said it was requiring students 12 and up to get the COVID-19 vaccine sooner than the statewide mandate would take effect. Students 12 and older and staff will be required to receive their first or second dose by November 30, unless they submit an exemption.

The decision comes after Gov. Gavin Newsom announced the nation’s first statewide school mandate that will go into effect once the vaccine gets full approval from the FDA.

MORE NEWS: Fourth of July Celebrations Will Cost You More This Year, But How Much?