An officer who has a reasonable suspicion that you have committed or are in the process of committing a crime has the authority to detain you. If there is reason to suspect that you are armed and dangerous, the officer can pat you down, or in other words, frisk you. This kind of search is widely known as a Terry frisk, named after the Supreme Court decision of Terry v. Ohio. (392 U.S. 1 (1968).) A Terry frisk must be limited—at least initially—to a search for weapons.
Officers must confine these kinds of frisks to the suspect’s outer clothing—they can’t go rummaging through your pockets. If, however, the officer feels something like a weapon during the frisk, he or she can reach into your clothing and retrieve it. Even if the object isn’t a weapon, a court will consider it to have been lawfully discovered if it reasonably appeared to be a one. In fact, an officer who feels something during a Terry frisk that obviously isn’t a weapon, but is obviously contraband, can seize it.
On the other hand, if the officer can’t tell from a frisk what the object is—only that it isn’t a weapon, he or she can’t explore it further. For example, the officer can’t squeeze it, slide it around, and otherwise manipulate it. (Minnesota v. Dickerson, 508 U.S. 366 (1993).) That said, the officer may be entitled to ask the suspect about the object. (State v. Scott, 518 N.W.2d 347 (Iowa 1994).)
If an officer didn’t have a legal basis for a Terry frisk or went beyond the limits of such a search, the resulting evidence will be inadmissible in court—if the defense files a motion to suppress evidence.
For more on the scope of Terry frisks, see The Difference Between a Police "Search" and a "Frisk."