S. Th. I-II, q. 79; De Malo q. 3, a. 1 and 2.
479. Sin, according to the formal element, insofar as it is privation, aversion, and defect, is not from God, who is not the cause except of being, nor can he move to aversion from himself: for he is the last end which inclines all things to himself. Which is de fide from C. Trid. sess. 6, can. 6, and from C. Araus. II, and Valentinus, and Later. IV.
But according to the material element or conversion: a) insofar as it is being, it is from God as from the first being by essence, and insofar as it is act, it is from God as from the first cause moving and applying all others to act; b) insofar however the material element is joined to a defect (or insofar as it is the foundation of privation), it is not from God but from a deficient cause, namely free choice: for the act of sin can be considered inadequately insofar as it retains something of the order of reason to good, and under this aspect it is not evil but good and is from God; also adequately, insofar as it does not have enough of the order of reason but deviates from it, and thus it is evil and is not from God but from the will falling short of the order. Just as whatever there is of motion in a limping is from the motive power of the soul, but that a defect of limping is joined to the motion, is not from the motive power but from the indisposition of the shin: so whatever there is of perfection and act in sin, is from God; but that this act is with a defect, is from free choice falling short of the order of reason: for God would move to a perfect act if free choice were not defectively disposed1.
480. God is not the cause of sin, as defined by C. Trid. sess. 6, can. 6: a) not a cause directly and of himself, as is evident from the preceding; nor b) a cause accidentally or indirectly, although he could prevent sin, by giving motion or efficacious grace for good, and sometimes does not prevent, by not granting this grace or even withdrawing it from those who place an obstacle: for he is not bound to give such grace and to prevent sin, which he nevertheless permits according to wisdom and justice (cf. Ps. V, 5; Ecclus. XV, 21; Rom. IX, 14; James I, 13; Deut. XXXIII; Wis. XIV, 9 together with XI, 25).