Nothing contained in this chapter shall apply to the regular military or naval forces of the United States; or to the duly organized military force of any state or territory thereof; or to police or fire departments in this state, provided they are acting within their respective official capacities and in the performance of their duties.