I have a question that’s weighing on my heart, and that’s the question of Buddhist countries having militaries for defense. To be short and sweet: Would there be any bad karma generated for Buddhist nations protecting itself; and in particular, protecting the Sangha—-even if it lead to all out war? How did the Buddha address things like this?
There are not really any “Buddhist Nations”, but just nations with a Buddhist majority.
In the suttas, there are no cases of physical self-defense being something that preserves or protects the Dhamma.
Kamma is action knowingly taken by an individual, not a nation. So, individuals in positions of power are heirs to wrong actions taken no matter how they attempt to justify them.