Do not execute the innocent or the righteous (Exodus 23:7)
The courts may not condemn the defendant in a capital case unless the witnesses can testify that they actually saw him doing the thing of which he was accused. A “pretty good idea” is not good enough. (It seems pretty obvious that we may not execute innocent people. By commanding us not to do so, the Torah is in effect saying, “Are you really sure he’s guilty? You’d better make sure before it’s too late!”)
Let’s say that you saw someone with a sword chasing an unarmed man. You yell out, “Stop! Don’t kill him! It’s a capital crime and you could be executed!” (Halacha requires that someone be warned in order to be liable to execution.) Then, you bend down to tie your shoe. When you get up, the victim is lying dead on the ground and the pursuer is holding a bloody sword. Since you missed the death blow, you would be unable to testify that this person committed murder. (It seems far-fetched, but how many TV mysteries revolve around an innocent person found holding the smoking gun? It’s unlikely but, as the saying goes, it’s better to acquit a thousand criminals than to execute a single innocent.)
The reason for this mitzvah is self-evident: circumstantial evidence is not reliable and if it were admissible, it would be inevitable that innocents would be unjustly executed.
The Mechilta elaborates on the details of this law. As we will see in Mitzvah #523, two witnesses are needed to convict. If two people testify that someone is guilty of a capital crime, but one says he committed idolatry and the other says he desecrated Shabbos, the man may not be convicted. Not only that, even if they both agree that the defendant committed idolatry, but they differ as to the idol he served, the accused goes free. Both witnesses have to observe the same act.
Another application of this mitzvah is that if someone is condemned, his case can be re-opened if there is new material to say in his defense. On the other hand, once acquitted, he is not subject to “double jeopardy.” (See Talmud Sanhedrin 33b.)
This mitzvah applied to the courts and only in Israel, as capital cases were not judged outside of the Holy Land. This mitzvah is discussed in the Talmud in the fourth chapter of Sanhedrin. It is codified in Choshen Mishpat 15. It is #290 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos