This practice is grounded in the U.S. Supreme Court case of Terry v. Ohio, 392 U.S. 1 (1968). In Terry, the Court held that a police officer may conduct a limited, warrantless search of a person's outer clothing (a "frisk") if the officer has a reasonable and articulable suspicion that the person might be armed and presently dangerous.
The Court emphasized that the officer must be able to point to specific and articulable facts that, when taken together with rational inferences from those facts, reasonably warrant the intrusion. This standard is less than the probable cause required for a full search, but it must be more than a mere hunch or unparticularized suspicion.