Nothing is an offence which is done by a person who is, or who by reason of a mistake of fact and not by reason of a mistake of law in good faith believes himself to be, bound by law to do it.
Illustration.—A, a soldier, fires on a mob by the order of his superior officer, in conformity with the commands of the law. A has committed no offence.