There is an excellent and thoughtful discussion on the topic as applied to the war in Myanmar. Bhikkhu Bodhi presents a compassionate and nuanced exploration of the realities of living in violent conditions such as war, and how to understand the Buddhas teachings in those circumstances.
With much metta