The Yetzer HaRah fulfills G-d's Will

It is obvious that even the Evil urge fulfills G-d's will in performing its task. The Zohar provides the following parable: ( p. 163)

A king once had a son who he loved very much. He ordered him not to go with any woman other than his wife, saying that if he did so, he would be banished from the royal palace. The son readily agreed to obey his father's order. After a while the king wanted to satisfy himself that he son was doing as he had been told.

Near the palace, there lived a beautiful harlot. The king summoned her, and ordered her to dress seductively and try to tempt the prince to sin with her. She was to use all her wiles; the king would thereby test his son, seeing whether or not he would pay attention to her. When the prince resisted this temptation, the king was extremely happy. He treasured his son, loving him even more than before, and gave him many valuable gifts. The one responsible for all this was the harlot.

The same is true here. If not for the Angel of Death, which is the Evil Urge that tempts man to sin, he would not be deserving of any reward for doing good. Our Sages therefore said, "Happy is he who does not encounter the Evil Urge, and happy is he who encounters the Evil Urge." This statement is not self-contradictory. When they say, "Happy is he who encounters the Evil Urge," they are speaking of the person who, upon being tempted to sin, wrestles with his urge and emerges victorious. If a person is weak and easily tempted, then "Happy is he who does not encounter the Evil Urge."

Do not think that the Evil Urge wishes to kill people; it derives no benefit from doing so. It does its Creator's will in tempting man, but it grieves when a man dies for his sins. The truly enlightened individual thanks the Evil Urge, since it is responsible for his ultimate reward. (Zohar, Shelach)