No staff officer of the armed forces of the state, including any officer of the pay, inspection, subsistence and medical departments, shall be appointed unless such officer has had previous military experience, and any such staff officer other than a medical officer of the State Guard shall hold office until he has reached the age of sixty-four years, unless retired prior to that time by reason of resignation or disability or for cause to be determined by a court-martial legally convened for that purpose or, for officers of the National Guard or naval militia, for any other reason specified by laws or regulations of the United States pertaining thereto. Medical officers of the State Guard may be appointed and may serve after reaching sixty-four years of age.