I read some comment stating that invasion of another country could never be justified (in the context of Russia and Ukraine), and decided to write down a non-exhaustive list of several scenarios that come to my mind, that follow the Augustinian principle of justified war.
1. State A is committing genocide against nationals of state B within its borders. State B wants to protect its expatriate nationals by invading state A, stopping genocide and changing the regime of the state A into some non-genocidal option.
2. State A has complete control of a vital resource (i.e. water) which it refuses to share with state B (for instance by diverting a river flow) with the understanding that the state B will be weakened and easy to conquer later, or perish on its own and be removed as competition. State B attacks state A and forces it to share the vital resource.
3. State A attacked state B with the goal of conquest and genocide, but the tide of war turned and the state B now invades state A and takes it under control in order to remove the threat. (Example: German invasion of the Soviet Union in WW2 and Soviet eventual invasion of Germany)
4. State A is a persistent threat and implacable foe to state B, performing constant hostile actions that kill its citizens, damage its infrastructure, degrade its economy and remove the feeling of safety. Having exhausted diplomatic options to resolve the situation, state B invades state A and regime-changes it.
5. State A (bordering state B) serves as a proxy for state C, who is a strategic enemy of state B, and allows dangerous weapons of mass destruction to be placed on its territory, increasing the vulnerability of state B to a strategic threat. State B threatens invasion of state A and immediate strategic retaliation against state B unless the threat is removed. If threat doesn’t work, it follows up on it. (Example: Cuban missile crisis)
6. State A is blocking trade routes over sea, land or air, or in other ways inhibiting trade, performing acts of piracy and so on, consistently harming the interests of state B and demonstrating implacable hostility. State B invades state A, changes its regime and removes the obstacle to free international trade.
Basically, all of the above examples imply self-defence, or defence of one’s own vital interests, and imply using only the minimum of force necessary to accomplish goals.
Russian invasion of Ukraine is justifiable according to principles in examples 1 and 5, and possibly 4; Ukraine was performing genocide against its Russian population, and served as a proxy for the strategic enemy who was using it as a platform for several attack vectors. The conditional classification under example 4 is justifiable by the fact that its government is an insanely criminal Nazi regime that is based on hatred against Russian people and state and is put into power and financed by Russia’s strategic enemies who are developing biological weapons there, targetting Russians, and performing international pressure against Russian attempts to diversify ways of exporting gas that wouldn’t include Ukraine, basically subverting Russian economy by direct hostile actions. They also openly stated the desire to acquire nuclear weapons. The combination of local ill-will and cooperation with strategic enemy creates a very serious threat level, but the concrete and persistent genocidal actions against the Russian population of Ukraine push the thing very strongly into the area that makes military intervention justifiable, especially since a peaceful solution was tried (the Minsk accords) and it turned out to be only a ruse with the purpose of buying time in order to create a more powerful military that could defeat Russia. It would be hard to imagine a clearer case of justifiable military intervention.