An insurer is liable when the thing insured is rescued from a peril insured against that otherwise would have caused a loss, if in the course of rescue the thing is exposed to peril not insured against which permanently deprives the insured of its possession in whole or in part.

The insurer is liable, also, when a loss is caused by efforts to rescue the thing insured from a peril insured against.