Tony Blair is often criticised for the Iraq War. In his defence, you seldom see consideration being given to what would have happened if Saddam Hussein had not been toppled. Perhaps the harm was not the War itself, but the fact that the subsequent peace was never won effectively.
In international law and philosophy there appear to be two principles that define a "Just War":
"jus ad bellume" - a war must be fought for a good reason
"jus in bello" - a war should be fought in a morally correct way.
Lets start with "good reason". One of the best reasons is national self-interest, the most justifiable self interest being self defence. But there can be other self interests and they must not be simply to gain advantage for such a reason is not just. Often, as we have seen in the Ukraine, wars are personalised by government, leaders or the media. Often when a politician acts many are affected. This is magnified when the decision is to fight a war. Politicians can seek to stand by "principles" which is easier when a smaller number are affected by the outcomes, but when those outcomes affect many more, even millions, "principles" need to be balanced with pragmatism. The interests of many can outweigh the interests of a few, but not always . We might not want political leaders to upholdcertain moral principles in times of conflict if too many are harmed as a result. Moral self indulgence can be very expensive.
Equally, appeasement can be costly in the long term as it weakens boundaries of behaviour and territory and risks sleepwalking into tyranny. Even inaction has a consequence. This was seen in WW2 when eventually Britain drew a line at Poland to set a boundary. Like Gandolf in the Lord of the Rings there has to be a point where you make a stand and cry, "You shall not pass." I feel that there is currently a strong movement in Europe, especially in France and Germany to appease Russia at the expense of Ukraine. Equally President Zelensky has a fine balancing act to weigh whether territory should be ceded to save lives and gain peace; a situation that is made more difficult when there is a pro-Russian separatist movement within Ukrainian territory.
This highlights a key issue when looking at your "good reason" for a War. It must be aiming to do more good than harm. To understand this the politician or leader needs to consider the best information available. In the case of the Iraq War this proved to be poor, but that was the risk.
Perhaps the most significant factor in considering a good reason to fight is that it must be likely to succeed. But again, success has many measures. For example, this requirement becomes less relevant when your enemy declares an intention to erase your very identity as a nation as we see Russia threatening Ukraine at the moment.
For war to be justified it should be fought in a "morally correct" way. This is a great responsibility and includes moral responsibility for collateral damage that cannot be avoided. Equally fighting war in a just way requires legitimate targets. This is, of course, problematic. If we consider the awful events of nuclear bombs being detonated over Hiroshima and Nagasaki that ended WW2 our judgement is affected by the death and destruction of many civilians in one hit as this has a greater emotional toll than the equivalent or greater number of deaths over a protracted conflict. If this is put to one side a moral justification for the two bombs does exist.
But when you justify war the pacifist will not see any justification. This is a valid view, but does pacifism risk suicide? Even the pacifist Yoko Ono had a guard for Sean after John Lennon was shot. At the very least pacifism risks loss of freedom. Is how to live more important than life? Whilst respecting the pacifist I wonder if nothing is worth killing for is anything worth living for? We need to remember and respect that a good many pacifists have died for their principles.
Finally, beware those that quote the biblical sixth commandment shared by the Abrahamic religions, "Thou shalt not kill." The original commandment in its language would have a more specific meaning: "Thou shalt not commit murder." This left both execution and war as justifiable means of killing. Thus, even religious justification can be given to War which is just as well considering the number of Wars that have been in the name of religion!