In these passages is the account of God directing Samuel to select a king over Israel. God directed Samuel to do this because of the people’s demand to have a king. God told Samuel that the people were not rejecting Samuel as a judge. Rather, they were rejecting God to be king over them.
The people had rejected God for years, and they still were not aligned with God in their hearts. So, God gave them over to their wishes, even though God knew that a human king would not be good for Israel.
I believe that sometimes God gives us over to our desires in order to teach us a lesson. If our desire is to fulfill our sinful desires, then the outcome will not be good for us.
The Bible says, “The wages of sin is death.” Sins can result in both physical and spiritual death. Spiritual death is eternal separation from God. That is not what I desire or choose. Therefore, I will strive to live my life in accordance with the Word of God.