171 Thou shalt not sacrifice to Jehovah thy God an ox or sheep wherein is a defect, or anything bad; for it is an abomination to Jehovah thy God. 2 If there be found in thy midst in any of thy gates which Jehovah thy God giveth thee, man or woman, that doeth what is evil in the sight of Jehovah thy God, in transgressing his covenant, 3 and goeth and serveth other gods, and boweth down to them, either to the sun or to the moon, or to the whole host of heaven, which I have not commanded; 4 and it be told thee, and thou hearest of it; then thou shalt make thorough inquiry, and if it be truth [and] the thing be certain, that this abomination hath been wrought in Israel, 5 thou shalt bring forth that man or that woman, who committed that wicked thing, unto thy gates, the man or the woman, and shalt stone them with stones, that they die. 6 At the mouth of two witnesses, or three witnesses, shall he that is to die be put to death: he shall not be put to death at the mouth of one witness. 7 The hands of the witnesses shall be first upon him to put him to death, and afterwards the hands of all the people; and thou shalt put evil away from thy midst.

Matthew Henry's Commentary on Deuteronomy 17:1-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.