The Christian Catholics of the middle ages were tired of wars beginning just for the war of it so they introduced the ‘Just War Theory’ a tradition or treaty that kingdoms were to respect.
A few of the main principles of the theory were that war had to be the last resort after all other attempts had been tried to resolve the case of issue. You also had to have a probability of success, you couldn’t go slaughtering everyone such as noncombatants and the king could not solely himself choose to wage war, he had to have other consent similar to congress.
This was a great idea and it was accepted but only for a short amount of time. As the world grows older people and rulers crave more unlimited power.