Our Parasha starts with halachot that come about by going out to war. It is the king who is involved in the decision to fight and leads the nation into it. Such power can lead its possessor to conceit. That is why the Torah dictates laws whose purpose is “so that his heart not be elevated above his brothers … and so that he shall have many years in his kingship, he and his sons in the midst of Israel” (Devarim 17:20). This shows that a candidate for kingship can fall if he is guilty of the sin of haughtiness.
We find two p’sukim in the Torah about wiping out Amalek: “You [Bnei Yisrael] shall wipe out the memory of Amalek” (Devarim 25:19); “I [Hashem] will certainly wipe out the memory of Amalek” (Shemot 17:14). There seems to be a contradiction as to who is responsible to rid the world of Amalek – Bnei Yisrael or Hashem? The Tanchuma (Ki Teitzei 11) answers that until Amalek raises his hands against the divine throne, Hashem leaves it to us; afterward, Hashem takes the matter into His own hands. In explaining how a human can raise his hands against the divine throne, the midrash answers that this is by destroying Yerushalayim.