This question concerns the correct battle assigned to Arjuna, rather than war in general.
Following the perspective of immortality of the soul, Krishna then addresses Arjuna's own duty. He states that there is nothing more fitting for a Kshatriya than to fight in a righteous battle.
However, this does not mean that anything is justified in war. The annotation limits the scope to wars undertaken as a duty, guided by dharma, and intended to uphold justice and righteousness, rather than those motivated by greed or evil intentions. What is being questioned is not simply the act of fighting, but also its motivation and legitimacy. This passage does not endorse all forms of war; instead, it examines Arjuna's svadharma from his specific circumstances.
Japanese Translation from the Gita Press Edition - Chapter 2, Section 31: "The Righteous Battle as a Duty of the Kshatriya"
Up until this point, based on the perspective of Samkhya Yoga, the soul's unity and its eternal and immutable nature have been demonstrated. The soul is permanent, pure, illuminating, impartial, unchanging, and not an actor. On the other hand, it was declared that the body is impermanent.
Therefore, it has been proven that lamenting the soul, the body, and even the separation of the soul from the body is irrational.
Furthermore, even if the soul is considered to be subject to birth and death, it has been shown that there is no reason to grieve about it, and Arjuna was ordered to fight.
Next, in the following seven verses, the Lord shows that it is irrational to grieve, even from the perspective of the code of honor prescribed for Kshatriyas. And Arjuna is encouraged to re-enter the battle.
Sanskrit original text
स्वधर्ममपि चावेक्ष्य न विकम्पितुमर्हसि ।
धर्म्याद्धि युद्धाच्छ्रेयोऽन्यत्क्षत्रियस्य न विद्यते ॥ ३१ ॥
Romanization
svadharmam api cāvekṣya na vikampitum arhasi |
dharmyād dhi yuddhāc chreyo 'nyat kṣatriyasya na vidyate || 31 ||
Furthermore, you should not be agitated when considering your own obligations. Because for a member of the warrior class, there is nothing more desirable than fighting justly. (31)
"Furthermore, even considering your own duties, you should not be agitated." In this sentence, the word "も" is used.
This indicates that, apart from the fact that the soul is immortal and the body is temporary, making it unreasonable to lament about them or retreat from battle, Arjuna should not feel fear even when considering the matter from the perspective of his own duties.
Because, for a Kshatriya, it was a natural obligation to not run away from the battlefield.
The invariant word "Hi" indicates a cause. This word is used to show that the basis for the recommendation above will be explained in the latter part of this section.
In the latter half, it is stated that for a Kshatriya, there is nothing more desirable than righteous warfare. Here, what the master indicates is not a war started from evil motives or greed, but a war conducted without injustice, in accordance with the laws of morality, namely Dharma, and which is imposed as an obligation upon oneself, and fought to uphold fairness and justice.
Only such battles are conducive to spiritual goodness for those of the Kshatriya caste, more so than any other form or aspect of Dharma. For a Kshatriya, there is no Dharma that surpasses or yields greater results than participating in such a battle. Because a Kshatriya who fights justly through righteous means can easily attain heaven, or even enlightenment.