6 On the evidence of two witnesses or of three witnesses the one who is to die shall be put to death; a person shall not be put to death on the evidence of one witness. 7 The hand of the witnesses shall be first against him to put him to death, and afterward the hand of all the people. So you shall purge[1] the evil[2] from your midst.

8 "If any case arises requiring decision between one kind of homicide and another, one kind of legal right and another, or one kind of assault and another, any case within your towns that is too difficult for you, then you shall arise and go up to the place that the Lord your God will choose. 9 And you shall come to the Levitical priests and to the judge who is in office in those days, and you shall consult them, and they shall declare to you the decision. 10 Then you shall do according to what they declare to you from that place that the Lord will choose. And you shall be careful to do according to all that they direct you. 11 According to the instructions that they give you, and according to the decision which they pronounce to you, you shall do. You shall not turn aside from the verdict that they declare to you, either to the right hand or to the left. 12 The man who acts presumptuously by not obeying the priest who stands to minister there before the Lord your God, or the judge, that man shall die. So you shall purge the evil from Israel.

Matthew Henry's Commentary on Deuteronomy 17:6-12

Commentary on Deuteronomy 17:1-7

(Read Deuteronomy 17:1-7)

No creature which had any blemish was to be offered in sacrifice to God. We are thus called to remember the perfect, pure, and spotless sacrifice of Christ, and reminded to serve God with the best of our abilities, time, and possession, or our pretended obedience will be hateful to him. So great a punishment as death, so remarkable a death as stoning, must be inflicted on the Jewish idolater. Let all who in our day set up idols in their hearts, remember how God punished this crime in Israel.

Commentary on Deuteronomy 17:8-13

(Read Deuteronomy 17:8-13)

Courts of judgment were to be set up in every city. Though their judgment had not the Divine authority of an oracle, it was the judgment of wise, prudent, experienced men, and had the advantage of a Divine promise.