P is an Orthodox Jew and ordained rabbi. After completing his Ph.D. in psychology, P entered active service in the United States Air Force as a commissioned officer. P served as a clinical psychologist at the mental health clinic on the base. Until 1981, P was not prevented from wearing his yarmulke on the base. He avoided controversy by remaining close to his duty station in the health clinic and by wearing his service cap over the yarmulke when out of doors. After he testified as a defense witness at a court-martial wearing his yarmulke but not his service cap, opposing counsel lodged a complaint that P's practice of wearing his yarmulke was a violation of Air Force Regulation (AFR) 35-10. This regulation states in pertinent part that '[headgear] will not be worn . . . [while] indoors except by armed security police in the performance of their duties.' AFR 35-10, para. 1-6.h(2)(f) (1980). P's commanding officer ordered him not to violate this regulation outside the hospital. P refused. The commanding officer revised his order to prohibit P from wearing the yarmulke even in the hospital. P received a formal letter of reprimand and was warned that failure to obey AFR 35-10 could subject him to a court-martial. His commanding officer also withdrew a recommendation that P's application to extend the term of his active service be approved, and substituted a negative recommendation. P sued D, the Secretary of Defense, and others, claiming that the application of AFR 35-10 to prevent him from wearing his yarmulke infringed upon his First Amendment freedom to exercise his religious beliefs. The court enjoined the enforcement of the regulation. The appeals court reversed. The Court of Appeals determined that the appropriate level of scrutiny of a military regulation that clashes with a constitutional right is neither strict scrutiny nor rational basis. It held that a military regulation must be examined to determine whether 'legitimate military ends are sought to be achieved,' and whether it is 'designed to accommodate the individual right to an appropriate degree.' The court concluded that 'the Air Force's interest in uniformity renders the strict enforcement of its regulation permissible.' The Supreme Court granted certiorari.