A mistake of fact is a legal defense that can be used in civil or criminal law. Essentially, when a crime is committed as a result of the defendant's ignorance of what actually constitutes a crime, this can be taken into consideration in the trial.
If the defendant did not know that what they were doing was wrong by virtue of the fact that they relied on a past law that was no longer in existence, or thought that the law was something other than what it was, it can be considered a mitigating factor in a case.
In any lawsuit, the plaintiff's legal representatives must prove that the defendant intended to do whatever it is that they are accusing the defendant of doing. If it is found that the defendant acted upon a mistaken belief that something existed, which did not, that ignorance must be granted and then the defendant would not be held to the same level of account as they would if they had actually intended to break the law.