The officials were acting on a tip from another student and were looking for prescription-strength ibuprofen, a painkiller. They made Ms. Redding strip to her underwear, shake her bra and pull aside her panties. The officials, both female, found no pills.

“What this school official did,” Mr. Wolf said, referring to the male assistant principal who ordered the search, “was act on nothing more than a hunch  if that  that Savana was currently concealing ibuprofen pills underneath her underpants for others’ oral consumption.”

“I mean, there’s a certain ick factor to this,” Mr. Wolf said.

Without intimating a view on the ickiness of what Mr. Wolf had described, Chief Justice John G. Roberts Jr. suggested that the law might treat different undergarments differently. “The issue here covers the brassiere as well,” he said, “which doesn’t seem as outlandish as the underpants.”

Justice Breyer elaborated on what children put in their underwear. “In my experience when I was 8 or 10 or 12 years old, you know, we did take our clothes off once a day,” he said. “We changed for gym, O.K.? And in my experience, too, people did sometimes stick things in my underwear.”

The courtroom rocked with laughter, and the justice grew a little flustered at having apparently misspoken.