1 Samuel 12:12
And when ye saw that Nahash the king of the children of Ammon came against you, ye said unto me, Nay; but a king shall reign over us: when the LORD your God was your king. And when ye saw that Nahash the king of the children of Ammon came against you, ye said unto me, Nay; but a king shall reign over us: when the LORD your God was your king.
When Nahash the king of the Ammonites came against Israel, the people demanded that a human king should reign over them, although the Lord their God was already their king. In making that demand they rejected God's rule over them. They turned the military threat into a reason to seek human kingship.
Instead they sought the customs and kingly authority of other nations, and in choosing their own way they made a great mistake. This overlooked how God had repeatedly fought for Israel and, when they turned from sin, had delivered them through leaders such as Gideon, Barak, Jephthah, and Samuel.
Their demand in the face of danger showed they had lost confidence and trust in God's power and wisdom to rule and defend them. Their distrustful demand displeased God.