Jesus gave two commands that on the surface seem to contradict each other.
Do not resist the one who is evil. But if anyone slaps you on the right cheek, turn to him the other also.
But now let the one who has a moneybag take it, and likewise a knapsack. And let the one who has no sword sell his cloak and buy one.
What is the point of owning a sword if you are forbidden to defend yourself against an attacker?