Whenever any portion of the National Guard, or of the unorganized militia when called into the service of the State, or Naval Militia is called into active service to suppress an insurrection or rebellion, to disperse a mob, or in an emergency or in any of the cases provided for in Sections 128, 143, or 146 of this code, or to enforce the execution of the laws of the State or of the United States, the commanding officer shall use his own discretion with respect to the propriety of attacking or firing upon any mob or unlawful assembly, or of attacking or using fire power in the military situation present. His honest and reasonable judgment in the exercise of his duty shall be full protection, civilly and criminally, for any act or acts done while on duty.