Deuteronomy 17:2-7

CLV(i) 2 In case there should be found among you, within one of your gates which Yahweh your Elohim is giving to you, a man or a woman who does evil in the eyes of Yahweh your Elohim so as to trespass against His covenant, 3 and he goes and serves other elohim and bows himself down to them or to the sun or to the moon or to any of the host of the heavens, something that I have instructed not to do, 4 and it has been told to you and you have heard it, then you will inquire diligently. And behold, if the truth of the matter is established that this abhorrence was done in Israel, 5 then you must bring forth that man or that woman who did this evil thing to your gates, the man or the woman, and you will stone them with stones so that they die. 6 At the mouth of two witnesses or three witnesses, the one about to die shall be put to death. He shall not be put to death at the mouth of one witness. 7 The hands of the witnesses shall come to be the first against him to put him to death and then the hands of all the people afterward. Thus you will eradicate the evil from among you.