Evil is not intended, but it often results because of lack of knowledge of The Good or the will is not directed toward The Good.
1 From this it is clear that evil occurs in things apart from the intention of the agents.
2 For that which follows from an action, as a different result from that intended by the agent, clearly happens apart from intention. Now, evil is different from the good which every agent intends. Therefore, evil is a result apart from intention.
3 Again, a defect in an effect and in an action results from some defect in the principles of the action; for instance, the birth of a monstrosity results from some corruption of the semen, and lameness results from a bending of the leg bone.
Now, an agent acts in keeping with the active power that it has, not in accord with the defect of power to which it is subject. According as it acts, so does it intend the end. Therefore, it intends an end corresponding to its power. So, that which results as an effect of the defect of power will be apart from the intention of the agent. Now, this is evil. Hence, evil occurs apart from intention.
Notes St Thomas knew of genetic diseases! (Joke.)
4 Besides, the movement of a mobile thing and the motion of its mover tend toward the same objective. Of itself, the mobile thing tends toward the good, but it may tend toward evil accidentally and apart from intention. This is best seen in generation and corruption. When it is under one form, matter is in potency to another form and to the privation of the form it already has.
Thus, when it is under the form of air, it is in potency to the form of fire and to the privation of the form of air. Change in the matter terminates in both at the same time; in the form of fire, in so far as fire is generated; in the privation of the form of air, inasmuch as air is corrupted.
Now, the intention and appetite of matter are not toward privation but toward form, for it does not tend toward the impossible. Now, it is impossible for matter to exist under privation alone, but for it to exist under a form is possible. Therefore, that which terminates in a privation is apart from intention. It terminates in a privation inasmuch as it attains the form which it intends, and the privation of another form is a necessary result of this attainment. So, the changing of matter in generation and corruption is essentially ordered to the form, but the privation is a consequence apart from the intention.
The same should be true for all cases of change. Therefore, in every change there is a generation and a corruption, in some sense; for instance, when a thing changes from white to black, the white is corrupted and the black comes into being. Now, it is a good thing for matter to be perfected through form, and for potency to be perfected through its proper act, but it is a bad thing for it to be deprived of its due act. So, everything that is moved tends in its movement to reach a good, but it reaches an evil apart from such a tendency. Therefore, since every agent and mover tends to the good, evil arises apart from the intention of the agent.
5 Moreover, in the case of beings that act as a result of understanding or of some sort of sense judgment, intention is a consequence of apprehension, for the intention tends to what is apprehended as an end. If it actually attains something which does not possess the specific nature of what was apprehended, then this will be apart from the intention. For example, if someone intends to eat honey, but he eats poison, in the belief that it is honey, then this will be apart from the intention.
But every intelligent agent tends toward something in so far as he considers the object under the rational character of a good, as was evident in the preceding chapter. So, if this object is not good but bad, this will be apart from his intention. Therefore, an intelligent agent does not produce an evil result, unless it be apart from his intention. Since to tend to the good is common to the intelligent agent and to the agent that acts by natural instinct, evil does not result from the intention of any agent, except apart from the intention.
Hence, Dionysius says, in the fourth chapter of On the Divine names: “Evil is apart from intention and will.”