Of course violence is necessary sometimes. You could simply ask yourself if the police are necessary in society or not. Or if surgery is sometimes necessary, If you think they are then you think violence / force is necessary, unless you know of some police somewhere that use super chill out mantras to subdue people or something, if you don't think they are necessary then good luck. By police I mean the principle of protection, force, defense, and even attack.
Imagine a world where nobody protected their spouses or families, nobody protected anybody from rape, murder, theft etc., nations didn't protect themselves from invasion, societies didn't protect themselves from oppression, nothing was worth protecting, nothing worth fighting for........who would want to live in such a society ?
Non harming is all well and good but it is passive, it doesn't imply doing anything it's simply a refraining. Sometimes passivity is very un compassionate, sometimes action is the highest compassion. If pacifists ran the world we'd all be speaking German now because of some weirdo german meth head on a power trip from hell.
I've always found this discussion topic to be amusing among Buddhists because I just have never understood why the topic's such a bogeyman for Buddhists because we all hold vows relating to this topic in mahayana and vajrayana, and yes it says sometimes it is not only necessary but one is bound by oath to act forcefully sometimes, if one has the means, physically or ritually.
Even if you are out in the middle of nowhere you still may need to protect yourself from an animal attack, this is a part of nature, this is life,.......or you could do the jataka tale Bodhisattva in training trip and just let it eat you, but certainly imposing this ideal on a societal level, throwing them to the lions and giving them a lollipop for being a good bodhisattva, not very compassionate. Force is necessary on a societal as well as personal level, this is life, even dharma has its police.
The nonexistence of the transcendence of suffering
is what the protector of the world has taught as the transcendence
Knots tied on space
are untied by space itself.
May I never be seperated from perfect masters in all lives,
and delightfully experiencing the magnificent dharma,
completing all qualities of the stages of the paths
may I quickly attain the state of Vajradhara