Ethical assessment of war, often discussed by medieval Christian theorists.
Whilst war causes injury, some wars are justifiable (ius ad bello) if their object is morally justifiable, and if there is a proportionate relation between ends and means (ius in bello).
David Miller et al., eds, The Blackwell Encyclopaedia of Political Thought (Oxford, 1987)
A 2017 study found that the just war tradition can be traced as far back as to Ancient Egypt, “demonstrating that just war thought developed beyond the boundaries of Europe and existed many centuries earlier than the advent of Christianity or even the emergence of Greco-Roman doctrine.” 
Chinese philosophy produced a massive body of work on warfare, much of it during the Zhou dynasty, especially the Warring States era. War was justified only as a last resort and only by the rightful sovereign; however, questioning the decision of the emperor concerning the necessity of a military action was not permissible. The success of a military campaign was sufficient proof that the campaign had been righteous.
Though Japan did not develop its own doctrine of just war, between the 5th and 7th centuries they drew heavily from Chinese philosophy, and especially Confucian views. As part of the Japanese campaign to take the northeastern island Honshu, Japanese military action was portrayed as an effort to “pacify” the Emishi people who were likened to “bandits” and “wild-hearted wolf cubs” and accused of invading Japan’s frontier lands.
The Indian Hindu epic, the Mahabharata, offers the first written discussions of a “just war” (dharma-yuddha or “righteous war”). In it, one of five ruling brothers (Pandavas) asks if the suffering caused by war can ever be justified. A long discussion then ensues between the siblings, establishing criteria like proportionality (chariots cannot attack cavalry, only other chariots; no attacking people in distress), just means (no poisoned or barbed arrows), just cause (no attacking out of rage), and fair treatment of captives and the wounded. The war in the Mahabharata is preceded by context that develops the “just cause” for the war including last-minute efforts to reconcile differences to avoid war. At the beginning of the war, there is the discussion of “just conduct” appropriate to the context of war.
In Sikhism, the term dharamyudh describes a war that is fought for just, righteous or religious reasons, especially in defence of one’s own beliefs. Though some core tenets in the Sikh religion are understood to emphasise peace and nonviolence, especially before the 1606 execution of Guru Arjan by Mughal emperor Jahangir, military force may be justified if all peaceful means to settle a conflict have been exhausted, thus resulting in a dharamyudh.
It was Aristotle who first introduced the concept and terminology to the Hellenic world where war was a last resort and required conduct that would not make impossible the restoration of peace. Aristotle generally has a favorable opinion of war and warfare to “avoid becoming enslaved to others” is justified as self-defense. As an exception to this, Aristotelian just war theory permitted warfare to enslave what Aristotle called “natural slaves”. In Aristotelian philosophy, the abolition of what he considers “natural slavery” would undermine civic freedom. The pursuit of freedom is inseparable from pursuing mastery over “those who deserve to be slaves”. According to The Cambridge Companion to Aristotle’s Politics the targets of this aggressive warfare were non-Greeks, noting Aristotle’s view that “our poets say ‘it is proper for Greeks to rule non-Greeks'”.
In ancient Rome, a “just cause” for war might include the necessity of repelling an invasion, or retaliation for pillaging or a breach of treaty. War was always potentially nefas (“wrong, forbidden”), and risked religious pollution and divine disfavor. A “just war” (bellum iustum) thus required a ritualized declaration by the fetial priests. More broadly, conventions of war and treaty-making were part of the ius gentium, the “law of nations”, the customary moral obligations regarded as innate and universal to human beings. The quintessential explanation of Just War theory in the ancient world is found in Cicero’s De Officiis, Book 1, sections 1.11.33–1.13.41. Although, it is well known that Julius Caesar did not often follow these necessities.
Christian theory of the Just War begins with Augustine of Hippo and Thomas Aquinas. The Just War theory, with some amendments, is still used by Christians today as a guide to whether or not a war can be justified. War may be necessary and right, even though it may not be good. In the case of a country that has been invaded by an occupying force, war may be the only way to restore justice. 
Saint Augustine held that, while individuals should not resort immediately to violence, God has given the sword to government for good reason (based upon Romans 13:4). In Contra Faustum Manichaeum book 22 sections 69–76, Augustine argues that Christians, as part of a government, need not be ashamed of protecting peace and punishing wickedness when forced to do so by a government. Augustine asserted that this was a personal, philosophical stance: “What is here required is not a bodily action, but an inward disposition. The sacred seat of virtue is the heart.”
Nonetheless, he asserted, peacefulness in the face of a grave wrong that could only be stopped by violence would be a sin. Defense of one’s self or others could be a necessity, especially when authorized by a legitimate authority:
They who have waged war in obedience to the divine command, or in conformity with His laws, have represented in their persons the public justice or the wisdom of government, and in this capacity have put to death wicked men; such persons have by no means violated the commandment, “Thou shalt not kill.”
While not breaking down the conditions necessary for war to be just, Augustine nonetheless originated the very phrase itself in his work The City of God:
But, say they, the wise man will wage Just Wars. As if he would not all the rather lament the necessity of just wars, if he remembers that he is a man; for if they were not just he would not wage them, and would therefore be delivered from all wars.
J. Mark Mattox writes that, for the individual Christian under the rule of a government engaged in an immoral war, Augustine admonished that Christians, “by divine edict, have no choice but to subject themselves to their political masters and [should] seek to ensure that they execute their war-fighting duty as justly as possible.”
Saint Thomas Aquinas
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. 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 Aristotle, Plato, Saint 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.
In Summa Theologica Aquinas asserted that it is not always a sin to wage war and set out criteria for a just war. According to Aquinas, three requirements must be met: First, the war must be waged upon the command of a rightful sovereign. Second, the war needs to be waged for just cause, on account of some wrong the attacked have committed. Thirdly, warriors must have the right intent, namely to promote good and to avoid evil. Aquinas came to the conclusion that a just war could be offensive and that injustice should not be tolerated so as to avoid war. Nevertheless, Aquinas argued that violence must only be used as a last resort. On the battlefield, violence was only justified to the extent it was necessary. Soldiers needed to avoid cruelty and a just war was limited by the conduct of just combatants. Aquinas argued that it was only in the pursuit of justice, that the good intention of a moral act could justify negative consequences, including the killing of the innocent during a war.