From Pope St. John Paul II’s encyclical Veritatis Splendor (1993):
O ne must therefore reject the thesis, characteristic of teleological and proportionalist theories, which holds that it is impossible to qualify as morally evil according to its species — its “object” — the deliberate choice of certain kinds of behaviour or specific acts, apart from a consideration of the intention for which the choice is made or the totality of the foreseeable consequences of that act for all persons concerned.
The primary and decisive element for moral judgment is the object of the human act, which establishes whether it is capable of being ordered to the good and to the ultimate end, which is God. This capability is grasped by reason in the very being of man, considered in his integral truth, and therefore in his natural inclinations, his motivations and his finalities, which always have a spiritual dimension as well. It is precisely these which are the contents of the natural law and hence that ordered complex of “personal goods” which serve the “good of the person”: the good which is the person himself and his perfection. These are the goods safeguarded by the commandments, which, according to Saint Thomas, contain the whole natural law.130
130 Cf. Summa Theologiæ, I-II, q. 100, a. 1.
— Veritatis Splendor 79