Cal. Civ. Proc. Code § 527.9
(f) The court may, as part of the relinquishment order, grant an exemption from the relinquishment requirements of this section for a particular firearm or ammunition if the respondent is not otherwise prohibited from owning, possessing, controlling, or purchasing a firearm and ammunition under state or federal law and one of the following applies:
(1)
(A) The respondent is currently employed as a sworn peace officer who is required, as a condition of continued employment, to carry a firearm, ammunition, or firearm and ammunition and the current employer is unable to reassign the peace officer to another position where use of a specified firearm or ammunition is unnecessary. In such a case, a court may allow the peace officer to continue to carry a specified firearm, ammunition, or firearm and ammunition, either on duty or off duty, if the court finds by a preponderance of the evidence, in writing or on the record, both of the following:
(2)
(g)
(j)