Jesus indicated to the disciples that when He left they would have to fend for themselves (not create an army - like they first thought He meant) and in Romans God through Paul mentions God using others to protect against evil aggressors. That makes me think that there are times, in the protection of the good against the evil that the sword is in the hand given by God.
Carry where legal - we are to obey man's laws unless it conflicts with God's Law.