Deuteronomy 17:14-20
If, after you have entered the land that the Lord your God has assigned to you, and taken possession of it and settled in it, you decide, "I will set a king over me, as do all the nations about me," you shall be free to set a king over yourself, one chosen by the Lord your God. Be sure to set as king over yourself one of your own people; you must not set a foreigner over you, one who is not your kinsman. Moreover, he shall not keep many horses or send people back to Egypt to add to his horses, since the Lord has warned you, "You must not go back that way again." And he shall not have many wives, lest his heart go astray; nor shall he amass silver and gold to excess.
When he is seated on his royal throne, he shall have a copy of this Teaching written for him on a scroll by the levitical priests. Let it remain with him and let him read in it all his life, so that he may learn to revere the Lord his God, to observe faithfully every word of this Teaching as well as these laws. Thus he will not act haughtily toward his fellows or deviate from the Instruction to the right or to the left, to the end that he and his descendants may reign long in the midst of Israel.