Deuteronomy 17:14–15 (ESV)

14 “When you come to the land that the LORD your God is giving you, and you possess it and dwell in it and then say, ‘I will set a king over me, like all the nations that are around me,’

Yes, God wants to use the kings to bring peace to his people. The time of the judges was chaotic. In those days there was no king in Israel. Everyone did what was right in his own eyes (Judges 21:25). Then God gave kings. He made a covenant with David: his kingship will be hereditary to bring God’s people to the King of their salvation, the son of David, that is Jesus Christ.