If the plaintiff fails to recover judgment in the action, he shall redeliver the property to the defendant, and be liable for all damages sustained by the defendant, which are proximately caused by operation of the temporary restraining order and preliminary injunction, if any, the levy of the writ of possession, and the loss of possession of the property pursuant to the levy of the writ of possession.
Ca. Civ. Code § 1861.15