Legitimate defense
The legitimate defense of persons and societies is not an exception to the prohibition against the murder of the innocent that constitutes intentional killing. "The act of self-defense can have a double effect: the preservation of one's own life; and the killing of the aggressor.... The one is intended, the other is not."
Source: Catechism of the Catholic Church (Vatican.va)