Mistake of law and mistake of fact are two types of defense by excuse, via which a defendant may argue that they should not be held criminally liable for breaking the law or liable for damages under a civil law action.

Most criminal courts do not recognize mistake of law; in which the defendant argues that they never knew of the law and thus should not be held liable. This defense is often countered with the cliched maxim: "Ignorance of the law is no excuse."

Mistake of fact is sometimes seen as valid; for example, if one were to go to an airport and pick up a bag which looked like one's own; and that bag were to contain a bomb, one might argue that a mistake had led to possession of the bomb, or another common example, taking another person's coat from a coatrack when you intended to take your own, this can also be interpreted as the lack of a mens rea. For a leading Supreme Court of Canada case on the mistaken belief defence see: R. v. Park.

In the civil law mistake may be used as a means to invalidate a contract, the famous case of the Peerless ship is an example in the case called Raffles v. Wichelhaus. The defendant had made an order for the purchase of cotton for goods arriving on a certain boat Peerless from Bombay leaving in October. However a different boat arrived called Peerless, also from Bombay, but having left in December. The plaintiff merchant sought to enforce the contract for the sale of cotton, but the defendant refused stating that it was not the cotton that he had ordered. Therefore there was a mistake and there was no contract.

See also Error.