6 But the thing displeased Samuel, when they said, Give us a king to judge us. And Samuel prayed unto Yahweh.

Though He was displeased at the demand, as it was in effect a rejection of Him, He nevertheless granted their request, and gave them Saul, of the tribe of Benjamin, until another man upon whom He had set His heart, should have been sufficiently trained in the school of adversity to take his place.

This was David, the son of Jesse, and of the tribe of Judah. God ordered Samuel to anoint him king over Israel. By this act David became the Lord's anointed, or Christ; and when he ascended the throne, ruled the nation as YAHWEH'S king.

Elpis Israel 2.4. p 310 Logos

7 And Yahweh said unto Samuel [Shmuel], Hearken [Shema] unto the voice of the people [HaAm] in all that they say unto thee: for they have not rejected thee, but they have rejected Me, that I should not reign [as Melech] over them.

8 According to all the works which they have done since the day that I brought them up out of Egypt [Mitzrayim] even unto this day, wherewith they have forsaken Me, and served other gods [elohim acherim], so do they also unto thee.

9 Now therefore hearken [pay heed] unto their voice: howbeit yet protest solemnly unto them, and shew them the manner of the king [mishpat hamelech (customary ways of the king, kingly perogative)] that shall reign over them.

10 And Samuel [Shmuel] told all the words [Divrei] of Yahweh unto the people that asked of him a king [Melech].

The request was a complete surprise and grief to Samuel who knew that as a commonwealth, directly governed by divine authority tabernacled in their midst between the cherubim, Israel enjoyed the most perfect political constitution possible to man in an evil state, and that a merely human head was a calamity to any people.

Samuel mourned the temper of the nation exceedingly, but God, whose own purpose was ultimately to give them a divine king, made use of the new phase of national feeling to open the way as it were, for the coming change. He instructed Samuel to comply with the people's request to anoint them a king, but to reprove them for the folly of their desires.

Ways of Providence Ch 14.