Nothing is an offence which is done by a person who is, or who by reason of a mistake of fact and not reason of a mistake of law in good faith believes himself to be, bound by law to do it.
An act done by someone who is legally bound to do it, or who mistakenly but honestly believes they are bound, is not an offence.