I answer that, The act of sin is both a being and an act; and in both respects it is from God. Because every being, whatever the mode of its being, must be derived from the First Being, as Dionysius declares (Div. Nom. v). Again every action is caused by something existing in act, since nothing produces an action save in so far as it is in act; and every being in act is reduced to the First Act, viz. God, as to its cause, Who is act by His Essence. Therefore God is the cause of every action, in so far as it is an action. But sin denotes a being and an action with a defect: and this defect is from the created cause, viz. the free-will, as falling away from the order of the First Agent, viz. God. Consequently this defect is not reduced to God as its cause, but to the free-will: even as the defect of limping is reduced to a crooked leg as its cause, but not to the motive power, which nevertheless causes whatever there is of movement in the limping. Accordingly God is the cause of the act of sin: and yet He is not the cause of sin, because He does not cause the act to have a defect.
More detail on this distinction is found in the first article, where he directly argues that God is not responsible for sin:
I answer that, Man is, in two ways, a cause either of his own or of another’s sin. First, directly, namely by inclining his or another’s will to sin; secondly, indirectly, namely by not preventing someone from sinning. Hence (Ezekiel 3:18) it is said to the watchman: “If thou say not to the wicked: ‘Thou shalt surely die’ [Vulgate: “If, when I say to the wicked, ‘Thou shalt surely die,’ thou declare it not to him.”] . . . I will require his blood at thy hand.” Now God cannot be directly the cause of sin, either in Himself or in another, since every sin is a departure from the order which is to God as the end: whereas God inclines and turns all things to Himself as to their last end, as Dionysius states (Div. Nom. i): so that it is impossible that He should be either to Himself or to another the cause of departing from the order which is to Himself. Therefore He cannot be directly the cause of sin. In like manner neither can He cause it indirectly. For it happens that God does not give some the assistance, whereby they may avoid sin, which assistance were He to give, they would not sin. But He does all this according to the order of His wisdom and justice, since He Himself is Wisdom and Justice: so that if someone sin it is not imputable to Him as though He were the cause of that sin; even as a pilot is not said to cause the wrecking of the ship, through not steering the ship, unless he cease to steer while able and bound to steer. It is therefore evident that God is nowise a cause of sin.
It is easy enough to see that if God is the first cause, everything else comes from that cause, including human action. In what sense, then, is St. Thomas asserting that something of sin is not from God?
The idea is that “doing evil” is not some positive reality in itself, but the lack of doing good. All positive reality comes from God, but not what is lacking.
The obvious objection, of course, is that if all good comes from God, then if some good is lacking, God must have failed to provide that good, and so he would be indirectly responsible. St. Thomas is responding to this when he says, “In like manner neither can He causes indirectly,” followed by the example with the pilot.
In the case of the pilot, he is not to be blamed for the wrecking of the ship unless he should have been steering and was not. But since God does all that he does “according to the order of His wisdom and justice,” then if he does not provide some good, it was not true that he ought to have provided it. Consequently he cannot be blamed for its lack.
This argument is valid as far as it goes, but we can understand the matter more fully by making a distinction here. In the argument above, St. Thomas virtually equates “causes indirectly” with being morally responsible for a thing, and consequently, based on an argument that God is not morally responsible for evil, concludes that “neither can He cause it indirectly.” But St. Thomas is well aware that causing something (especially causing indirectly) and being morally responsible for a thing are two different things. Thus he justifies killing in self defense:
Accordingly the act of self-defense may have two effects, one is the saving of one’s life, the other is the slaying of the aggressor. Therefore this act, since one’s intention is to save one’s own life, is not unlawful, seeing that it is natural to everything to keep itself in “being,” as far as possible.
Evidently someone who does this causes the death of the aggressor. But he is not morally responsible for it. Thus causing something, especially indirectly, is not the same as being morally responsible for it.
Consider the case of the pilot of the ship. St. Thomas says that “a pilot is not said to cause the wrecking of the ship, through not steering the ship, unless he cease to steer while able and bound to steer.” But if we are considering mere causality, it is evident that whether or not the pilot is under an obligation of steering the ship is irrelevant. St. Thomas’s point is that if the pilot is doing something else more important, then he is not to blame for the destruction of the ship, even if theoretically he could have steered and failed to do the more important thing instead. This is true but the point is about blame, not causality. The destruction of the ship is indeed an indirect effect of the pilot’s action, even if the pilot’s action was morally praiseworthy, because he was doing something else more important.
And in that sense, all things, whether good or evil, reduce to the causality of the first cause, directly or indirectly.