2 "When you begin living in the towns the Lord your God is giving you, a man or woman among you might do evil in the sight of the Lord your God and violate the covenant. 3 For instance, they might serve other gods or worship the sun, the moon, or any of the stars-the forces of heaven-which I have strictly forbidden. 4 When you hear about it, investigate the matter thoroughly. If it is true that this detestable thing has been done in Israel, 5 then the man or woman who has committed such an evil act must be taken to the gates of the town and stoned to death. 6 But never put a person to death on the testimony of only one witness. There must always be two or three witnesses. 7 The witnesses must throw the first stones, and then all the people may join in. In this way, you will purge the evil from among you.

Matthew Henry's Commentary on Deuteronomy 17:2-7

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.