Catechism of the Catholic Church §1756 — excerpt
It is therefore an error to judge the morality of human acts by considering only the intention that inspires them or the circumstances (environment, social pressure, duress or emergency, etc.)
This translation is under copyright, so only the cited words are quoted here. Follow the link for the full text. Translation: English translation of the Catechism of the Catholic Church, 2nd ed. (Libreria Editrice Vaticana), as posted at vatican.va.
