BAKERSFIELD (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: South Bay Retailer Shutters Store in Response to Smash-and-Grab Crime Wave

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. The Sacramento Bee first reported Barmann’s ruling on Friday.

READ MORE: Grieving Family Members Call for Justice for Slain Security Guard Kevin Nishita

“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.”

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. 7.

MORE NEWS: Warriors End Suns’ Win Streak at 18 With 118-96 Victory

© Copyright 2021 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.