Aa
1“Do not sacrifice to the Lord your God an ox or sheep with a defect or any serious flaw, for that is detestable to the Lord your God.17:1 Lv 3:1,6; 9:2–3; 21:17–23; 22:17–25; 23:12; Nm 19:2; Dt 15:21; Mal 1:8; Heb 9:14; 1Pt 1:19; 2Pt 3:14
The Judicial Procedure for Idolatry
2“If a man or woman among you in one of your towns that the Lord your God will give you is discovered doing evil in the sight of the Lord your God and violating his covenant17:2 Dt 31:16
3and has gone to serve other gods17:3 Dt 13:6,13; Jos 23:16 by bowing in worship to the sun, moon, or all the stars in the sky17:3 Dt 4:19; 2Kg 23:5; Jb 31:26–28; Ps 148:3; Is 24:23; 60:19–20; Jr 8:2 — which I have forbidden17:2–5 Dt 13:12–15; 29:18 — 
4and if you are told or hear about it, then investigate it thoroughly. If the report turns out to be true that this detestable act has been done in Israel,
5you are to bring out to your city gates that man or woman who has done this evil thing and stone them to death.17:5 Dt 22:24
6The one condemned to die is to be executed on the testimony of two or three witnesses.17:6 Dt 19:15; Mt 18:16; 2Co 13:1; 1Tm 5:19; Heb 10:28 No one is to be executed on the testimony of a single witness.
7The witnesses’ hands are to be the first in putting him to death, and after that, the hands of all the people.17:7 Dt 13:9 You must purge the evil from you.17:7 Dt 13:5; 19:19; 21:21; 22:21–24; 24:7; 1Co 5:13
Difficult Cases
8“If a case is too difficult for you — concerning bloodshed,17:8 Ex 21:12–14,18–25; Nm 35:9–34; Dt 19:1–13; 25:7 lawsuits,17:8 Ex 22:6–14 or assaults17:8 Ex 21:22–26; Lv 24:19–20 — cases disputed at your city gates,17:8 Dt 21:19; 22:15 then go up to the place the Lord your God chooses.
9You are to go to the Levitical priests and to the judge who presides at that time. Ask, and they will give you a verdict in the case.
10You must abide by the verdict they give you at the place the Lord chooses. Be careful to do exactly as they instruct you.
11You must abide by the instruction they give you and the verdict they announce to you. Do not turn to the right or the left from the decision they declare to you.
12The person who acts arrogantly, refusing to listen either to the priest who stands there serving the Lord your God or to the judge, must die. You must purge the evil from Israel.
13Then all the people will hear about it, be afraid, and no longer behave arrogantly.
Appointing a King
14“When you enter the land the Lord your God is giving you,17:14 Dt 26:1 take possession of it, live in it, and say, ‘I will set a king over me like all the nations around me,’
15you are to appoint over you the king the Lord your God chooses.17:14–15 1Sm 8:4–22 Appoint a king from your brothers. You are not to set a foreigner over you, or one who is not of your people.17:15 Gn 17:6,16; 35:11; Nm 24:17–19
16However, he must not acquire many horses for himself or send the people back to Egypt to acquire many horses, for the Lord has told you, ‘You are never to go back that way again.’17:16 1Kg 10:28–29
17He must not acquire many wives for himself so that his heart won’t go astray.17:17 1Kg 11:3–4 He must not acquire very large amounts of silver and gold for himself.17:17 1Kg 10:21–25
18When he is seated on his royal throne, he is to write a copy of this instruction for himself on a scroll in the presence of the Levitical priests.
19It is to remain with him, and he is to read from it all the days of his life, so that he may learn to fear17:19 Dt 14:23 the Lord his God, to observe all the words of this instruction, and to do these statutes.
20Then his heart will not be exalted above his countrymen, he will not turn from this command to the right or the left, and he and his sons will continue reigning many years17:20 Lit will lengthen days on his kingdom in Israel.