עַתָּה֩ לֵ֨ךְ וְהִכִּֽיתָ֜ה אֶת־עֲמָלֵ֗ק וְהַֽחֲרַמְתֶּם֙ אֶת־כָּל־אֲשֶׁר־ל֔וֹ וְלֹ֥א תַחְמֹ֖ל עָלָ֑יו וְהֵמַתָּ֞ה מֵאִ֣ישׁ עַד־אִשָּׁ֗ה מֵֽעֹלֵל֙ וְעַד־יוֹנֵ֔ק מִשּׁ֣וֹר וְעַד־שֶׂ֔ה מִגָּמָ֖ל וְעַד־חֲמֽוֹר׃ (ס)
지금 가서 아말렉을 쳐서 그들의 모든 소유를 남기지 말고 진멸하되 남녀와 소아와 젖먹는 아이와 우양과 약대와 나귀를 죽이라 하셨나이다
Mishneh Torah, Kings and Wars
The appointment of the king comes before the war with Amalek, as it says, “G-d has sent me to anoint you king…Now, go and smite Amalek” (I Samuel 15:1-3). The eradication of Amalek precedes the construction of the Temple, as it says, “and it was so, when the king was settled in his home, and G-d allowed him respite from his enemies all around. And the king said to Nathan, the Prophet, ‘I am living in a house of cedar…’” (II Samuel 7:1-2). Now, since the appointment of a king is a Commandment, why did G-d not want (a king) when the people asked Samuel for one? Because their request was merely due to resentment, and not for the purpose of fulfilling a Commandment. They had rejected Samuel the Prophet, as it says, “as they have forsaken Me…so do they also with you” (I Samuel 8:7).