Shmuel Alef Perek 8
The Gemara in Sanhedrin tells us that Bnei Yisrael became obligated in three mitzvos upon entering the Land of Israel: to appoint a king; to destroy Amalek; and to build a Mikdash (in that order). If it is such a positive thing to appoint a king, why did Shmuel get angry with Bnei Yisrael when the masses asked for a king (8:5)? Isn’t there an explicit mitzvah in the Torah to appoint a Jewish king (in Parshas Shoftim 17:15)?
The Radak, Rambam and Ralbag explain (based on Chazal) that Shmuel criticised the peoples' request for a king on the basis of the way they phrased their request. The manner in which they asked for a king demonstrated that they were hiding ulterior motives under the guise of the mitzvah to appoint a king. The demanding tone of 'appoint' rather that 'give' revealed a. Lack of total faith in Hashem's Kingship, because they seemed so desperate to appoint a human king. Additionally, they asked that Shmuel to appoint for them a king 'like all the nations'; the B'nei Yisroel wanted a king to function in the role assumed by kings in neighbouring countries - primarily to fight their battles. This is not the focus for the Jewish king; this is something that Hashem, Himself, would do. Rather, the role of the Jewish king is to unite the people and bring them to a better service of Hashem. Moreover, the Radak says that some people wanted a king to lead them to serve idols - the very opposite of his true role. Thus, Shmuel was valid in his criticism of the peoples' request.
On a deeper level, what is the concept behind appointing a king? Such a crucial mitzvah that must be done precisely and correctly, to the extent that the Rambam writes that it is prohibited to appoint a king who is not from the lineage of Dovid, and that such a king from ‘Malchus Yisrael’ loses his ‘title’ as king if he does not follow the ways of Hashem. Though the Rambam himself writes (at the end of perek 4 of Hilchos Melachim) that a king is there to administer justice and fight wars, Rav Dessler provides a deeper angle to this, explaining that a king unifies the nation and provides us with a national identity so that we can then serve Hashem as a collective entity. Thus, a king must carry around a Sefer Torah with him and be a man of extreme humility – recognising his role as merely a conduit via which the people are united to serve Hashem. However the Bnei Yisrael did not recognise the true role of a king and did not wish for the king to embody the fact that Hashem runs the world, thus they were definately not fulfilling the Mitzvah of appointing a Jewish king. The Rambam describes how the appointment of a king is crucial to be done correctly - he must be from the lineage of Dovid, and that if the king does not follow in the ways of Hashem, he loses his title of king. The king must also carry a Sefer Torah with him at all times, for this is his primary goal - to bring the people closer to the Torah, closer to Hashem. The Sefer Torah also served as a reminder that the king is a mere conduit between the people and Hashem. Thus, granted the intent within the peoples' request, Shmuel was justified in his criticism. This is ultimately the reason why they were punished for wanting to have a king as their motives were warped. We learn the importance of seeing Hashem as the Force running the world, not rulers. We must realise who is the true King of all Kings.