In order for a war to be just, three things are necessary.
First, the authority of the sovereign by whose command the war is to be waged. For it is not the business of a private individual to declare war, because he can seek for redress of his rights from the tribunal of his superior. Moreover it is not the business of a private individual to summon together the people, which has to be done in wartime. And as the care of the commonweal is committed to those who are in authority, it is their business to watch over the commonweal of the city, kingdom or province subject to them. And just as it is lawful for them to have recourse to the sword in defending that commonweal against internal disturbances, when they punish evil-doers, according to the words of the Apostle (Rm. 13:4): “He beareth not the sword in vain: for he is God’s minister, an avenger to execute wrath upon him that doth evil”; so too, it is their business to have recourse to the sword of war in defending the commonweal against external enemies. Hence it is said to those who are in authority (Ps. 81:4): “Rescue the poor: and deliver the needy out of the hand of the sinner”; and for this reason Augustine says (Contra Faust. xxii, 75): “The natural order conducive to peace among mortals demands that the power to declare and counsel war should be in the hands of those who hold the supreme authority.”
Secondly, a just cause is required, namely that those who are attacked, should be attacked because they deserve it on account of some fault. Wherefore Augustine says (Questions. in Hept., qu. x, super Jos.): “A just war is wont to be described as one that avenges wrongs, when a nation or state has to be punished, for refusing to make amends for the wrongs inflicted by its subjects, or to restore what it has seized unjustly.”
Thirdly, it is necessary that the belligerents should have a rightful intention, so that they intend the advancement of good, or the avoidance of evil. Hence Augustine says (De Verb. Dom. [*The words quoted are to be found not in St. Augustine’s works, but Can. Apud. Caus. xxiii, qu. 1]): “True religion looks upon as peaceful those wars that are waged not for motives of aggrandizement, or cruelty, but with the object of securing peace, of punishing evil-doers, and of uplifting the good.” For it may happen that the war is declared by the legitimate authority, and for a just cause, and yet be rendered unlawful through a wicked intention. Hence Augustine says (Contra Faust. xxii, 74): “The passion for inflicting harm, the cruel thirst for vengeance, an unpacific and relentless spirit, the fever of revolt, the lust of power, and such like things, all these are rightly condemned in war.” – from Summa Theologiae