Deuteronomy 19:19-20

19:19 you must do to him what he had intended to do to the accused. In this way you will purge evil from among you. 19:20 The rest of the people will hear and become afraid to keep doing such evil among you.