If after request a public entity fails or refuses to provide an employee or former employee with a defense against a civil action or proceeding brought against him and the employee retains his own counsel to defend the action or proceeding, he is entitled to recover from the public entity such reasonable attorney's fees, costs and expenses as are necessarily incurred by him in defending the action or proceeding if the action or proceeding arose out of an act or omission in the scope of his employment as an employee of the public entity, but he is not entitled to such reimbursement if the public entity establishes (a) that he acted or failed to act because of actual fraud, corruption or actual malice, or (b) that the action or proceeding is one described in Section 995.4.
Nothing in this section shall be construed to deprive an employee or former employee of the right to petition for a writ of mandate to compel the public entity or the governing body or an employee thereof to perform the duties imposed by this part.
Ca. Gov. Code § 996.4