כי תצא למלחמה על אויבך ונתנו ה' אלהיך בידך ושבית שביו, שמעתי ממורי זלה"ה ביאור פסוק כי תצא למלחמה על אויביך וגו' ושבית שביו, כי על ידי טענת היצר הרע עצמו, בזה כובש את היצר הרע, שאם הוא זריז במלאכתו לפתות את האדם בעברה, כדי לעשות שליחות השם יתברך, כמו שכתוב בזוהר (פ' תרומה דקס"ג ע"א) משל הזונה, מזה יקח האדם מוסר לעצמו, שיהיה הוא זריז במלאכתו, שלא לשמוע ליצר הרע, שהוא רצון קונו יתברך שמו וכו', ודפח"ח:
(תוי"י פ' בחקותי דקכ"ו ע"ד). When you go out to war against your enemies, and the L-rd your G‑d gives them into your hand, so that you will take captives. (Deuteronomy 21:10)
Through the very devices of the evil inclination, the evil inclination itself can be defeated. If it is quick in its work to entice a person to sin, in order to fulfill G‑d’s commandment (as the Zohar relates with the parable of the prostitute1The Zohar (2:163a) defines the nature of the evil inclination with a parable: “This is like a king who had an only son, whom he loved very much. He ordered him not to not to associate with any evil woman, for whoever drew near to an evil woman is not fit to enter the king’s chamber. The son promised that he would fulfill his father’s will in love. Outside the king’s palace was a prostitute, of beautiful appearance and form. Days past, and the king said, ‘I want to see my son’s commitment to me.’ He called that prostitute and told her to seduce his son. She followed the king’s son and began to hug him and kiss him, and to seduce him in many different ways. If that son is upright, and upholds his father’s orders, he will berate her and not listen to her, and push her away. Then the father will be happy with his son, and bring him into his chamber, and give him gifts and great honor. Who caused the son to receive such honor? That prostitute.”), then a person should also learn to be quick in his efforts not to listen to the evil inclination, which is the will of G‑d [for him].
Toldos Yaakov Yosef, Bechukosai, p. 126d