you may indeed set a king over you whom the Lord your God will choose. One from among your brothers you shall set as king over you. You may not put a foreigner over you, who is not your brother.
Solomon in 1 Kings 9-11 does all of these things even though he is the wisest man in the world. So even the wisest man in history falls into the weakness of the flesh