411. I Must Recuse Myself: The prohibition against a witness serving as a judge
…one witness may not speak to execute a person. (Numbers 35:30)
A witness in a capital crime may not serve as a judge on the same case, even if he is the wisest, most learned jurist around. As a consequence of witnessing the events in question, the person loses the ability to weigh them objectively, applying the law when it goes counter to his preconceived conclusions. Accordingly, he may only report what he saw, but not speak in favor of conviction or acquittal.
This mitzvah applies in Temple times, when capital crimes are tried. It is discussed in the Talmud in tractate Sanhedrin (33b) and Kesubos (21). This mitzvah is codified in the Mishneh Torah in the fifth chapter of Hilchos Eidus. It is #291 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.