From Wiki:

The just war theory by Thomas Aquinas has had a lasting impact on later generations of thinkers and was part of an emerging consensus in Medieval Europe on just war.[24] In the 13th century Aquinas reflected in detail on peace and war. Aquinas was a Dominican friar and contemplated the teachings of the Bible on peace and war in combination with ideas from AristotlePlatoSaint Augustine and other philosophers whose writings are part of the Western canon. Aquinas’ views on war drew heavily on the Decretum Gratiani, a book the Italian monk Gratian had compiled with passages from the Bible. After its publication in the 12th century, the Decretum Gratiani had been republished with commentary from Pope Innocent IV and the Dominican friar Raymond of Penafort. Other significant influences on Aquinas just war theory were Alexander of Hales and Henry of Segusio.[25]


From Summa Theologica:

On the contrary, Augustine says in a sermon on the son of the centurion (cf. Ep. ad Marccl., cxxxviii.): If the Christian Religion forbade war altogether, those who sought salutary advice in the Gospel would rather have been counselled to cast aside their arms, and to give up soldiering altogether. On the contrary, they were told: ‘Do violence to no man; … and be content with your pay.’* If he commanded them to be content with their pay, he did not forbid soldiering.

I answer that, 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 common weal is committed to those who are in authority, it is their business to watch over the common weal 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 common weal against internal disturbances, when they punish evil-doers, according to the words of the Apostle (Rom. 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 common weal 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.): 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 (Q. 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.*): True religion looks upon as peaceful those wars that are waged not for motives of aggrandisement, 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.): The passion for inflicting harm, the cruel thirst for vengeance, an unpacific and relentless spirit, the fever of revolt, the lust of power, and suchlike things, all these are rightly condemned in war.

Thomas Aquinas, Summa Theologica, trans. Fathers of the English Dominican Province (London: Burns Oates & Washbourne, n.d.).