The Catechism of the Catholic Church teaches: “The fifth commandment forbids the intentional destruction of human life. Because of the evils and injustices that accompany all war, the Church insistently urges everyone to prayer and to action so that the divine Goodness may free us from the ancient bondage of war” (#2307).
Having noted that governments have the right of lawful self-defense, “once all peace efforts have failed” (#2308), the Catechism goes on to describe a just war as one where “the damage inflicted by the aggressor on the nation or community of nations must be lasting, grave and certain; all other means of putting an end to it must have been shown to be impractical or ineffective; there must be serious prospects of success; the use of arms must not produce evils and disorders graver than the evil to be eliminated. The power of modern means of destruction weighs very heavily in evaluating this condition” (#2309).
Those who serve their country in the armed forces can contribute to the common good of the nation (#2310). “Public authorities should make equitable provision for those who for reasons of conscience refuse to bear arms; these are nonetheless obliged to serve the human community in some other way” (#2311).