Deuteronomy 17:1-20 NKJV
“You shall not sacrifice to the LORD your God a bull or sheep which has any blemish or defect, for that is an abomination to the LORD your God.
“If there is found among you, within any of your gates which the LORD your God gives you, a man or a woman who has been wicked in the sight of the LORD your God, in transgressing His covenant, who has gone and served other gods and worshiped them, either the sun or moon or any of the host of heaven, which I have not commanded, and it is told you, and you hear of it, then you shall inquire diligently. And if it is indeed true and certain that such an abomination has been committed in Israel, then you shall bring out to your gates that man or woman who has committed that wicked thing, and shall stone to death that man or woman with stones. Whoever is deserving of death shall be put to death on the testimony of two or three witnesses; he shall not be put to death on the testimony of one witness. The hands of the witnesses shall be the first against him to put him to death, and afterward the hands of all the people. So you shall put away the evil from among you.
“If a matter arises which is too hard for you to judge, between degrees of guilt for bloodshed, between one judgment or another, or between one punishment or another, matters of controversy within your gates, then you shall arise and go up to the place which the LORD your God chooses. And you shall come to the priests, the Levites, and to the judge there in those days, and inquire of them; they shall pronounce upon you the sentence of judgment. You shall do according to the sentence which they pronounce upon you in that place which the LORD chooses. And you shall be careful to do according to all that they order you. According to the sentence of the law in which they instruct you, according to the judgment which they tell you, you shall do; you shall not turn aside to the right hand or to the left from the sentence which they pronounce upon you. Now the man who acts presumptuously and will not heed the priest who stands to minister there before the LORD your God, or the judge, that man shall die. So you shall put away the evil from Israel. And all the people shall hear and fear, and no longer act presumptuously.
“When you come to the land which the LORD your God is giving you, and possess it and dwell in it, and say, ‘I will set a king over me like all the nations that are around me,’ you shall surely set a king over you whom the LORD your God chooses; one from among your brethren you shall set as king over you; you may not set a foreigner over you, who is not your brother. But he shall not multiply horses for himself, nor cause the people to return to Egypt to multiply horses, for the LORD has said to you, ‘You shall not return that way again.’ Neither shall he multiply wives for himself, lest his heart turn away; nor shall he greatly multiply silver and gold for himself.
“Also it shall be, when he sits on the throne of his kingdom, that he shall write for himself a copy of this law in a book, from the one before the priests, the Levites. And it shall be with him, and he shall read it all the days of his life, that he may learn to fear the LORD his God and be careful to observe all the words of this law and these statutes, that his heart may not be lifted above his brethren, that he may not turn aside from the commandment to the right hand or to the left, and that he may prolong his days in his kingdom, he and his children in the midst of Israel.
NKJV: New King James Version