Regarding killing animals, it is mentioned in the Zohar (2:68b) that no creature was created purposelessly.
It is [therefore] forbidden to kill purposelessly,
as the Sages state:
"All that the Holy One, blessed be He, created, He created only for His honor, as it is written, All that is called in My Name and for My honor, I created it, I formed it, I even made it." (Avot 6:11; Isaiah 43:7)
We will see now how the Arizal took this statement to extreme conclusions, conducting himself with extreme piety in this matter.
My teacher [the Arizal] was very careful not to kill any bug, even the smallest and lowliest, such as fleas, lice, flies, and the like, even when they bit him.
We know what the Sages say, commenting on the verse, "His enemies will also make peace with him," (Proverbs 16:7) that some say this refers to the dog and others say this refers to the snake, and still others say this refers to the flea. (Y. Terumah 8:3)
This idea is the answer of Rabbi Elazar to Rabbi Chizkiyah recorded in the Zohar (2:68b), where the mystical meaning of the verse, "Will the snake bite without whispering?" (Eccl. 10:11) is explained. Will the snake bite without whispering?
Rabbi Elazar and Rabbi Chizkiyah were walking and came across a snake. Rabbi Chizkiyah was about to kill it, but Rabbi Elazar told him not to. When Rabbi Chizkiyah protested, saying that it is a dangerous creature, Rabbi Elazar quoted the above verse, interpreting it to mean that a snake only bites a person if G‑d "whispers" to him to do so. G‑d created snakes in order to kill certain people and thereby prevent them from doing some evil.
To be sure, we should not kill any creature unnecessarily, but refraining from killing animals that pose a threat to human life (or communicate diseases) contradicts the requirements of Jewish law, and it is doubtful whether any Torah authority would permit this. Indeed, it is permitted to kill harmful snakes on the Sabbath, when killing is otherwise altogether prohibited.
The Arizal, we may presume, did not have to worry about leaving snakes alive because he did not have to fear being stuck down by one to prevent him from sinning. On the other hand, we see that he was bitten by insects and bugs. The question is how the Arizal could refrain from killing snakes and the like and allow them to pose a threat to others' lives. Perhaps the Arizal only meant that we should not kill snakes in their natural, wild habitat, but that if they venture into heavily peopled areas, we should kill them (or if possible, return them back to the wild).
But all of this is just conjecture. It could just as well be that the Arizal advocated avoiding killing creatures altogether, even at the expense of human life.
It is also not proper to kill or despise lice, which are born and created out of sweat. This is true especially [of lice produced on the heads] of good people. Sweat is the excess [energy] of the person and his dross, and from it these lice are created; this being the case, it is a boon and a rectification for the person when lice are created out of the sweat of his body, for in this way his excess, dross, and evil is excreted. [Since they perform a positive function,] we should not despise them.
Translated and adapted by Moshe-Yaakov Wisnefsky from Likutei Torah and Shaar HaMitzvot, parashat Noach; subsequently published in "Apples From the Orchard."
Reprinted with permission from Chabad of California. Copyright 2004 by Chabad of California, Inc. All rights reserved, including the right to reproduce this work or portions thereof, in any form, without permission, in writing, from Chabad of California, Inc.