Neither a public entity nor a public employee acting within the scope of his employment is liable for interfering with the right of a prisoner to obtain a judicial determination or review of the legality of his confinement; but a public employee, and the public entity where the employee is acting within the scope of his employment, is liable for injury proximately caused by the employee's intentional and unjustifiable interference with such right, but no cause of action for such injury shall be deemed to accrue until it has first been determined that the confinement was illegal.
Ca. Gov. Code § 845.4