No officer of a public or private agency, nor the superintendent, professional person in charge, his or her professional designee, or attending staff of any such agency, nor any public official performing functions necessary to the administration of this chapter, nor peace officer responsible for detaining a person pursuant to this chapter, nor the state, a unit of local government, an evaluation and treatment facility, a secure withdrawal management and stabilization facility, or an approved substance use disorder treatment program shall be civilly or criminally liable for performing duties pursuant to this chapter with regard to the decision of whether to detain a person for medical clearance or treatment, provided that such duties were performed in good faith and without gross negligence.