The first time David Floyd was stopped and frisked, on a Friday afternoon in April 2007, he was walking down Beach Avenue a few doors from his house in the Bronx when two police officers confronted him, demanding to know who he was, where he was going, what he was doing, and whether he was carrying any weapons. Floyd, at the time a freelance film editor and now a medical student, presented his driver's license and explained that he was walking home.

Unsatisfied, one of the officers searched Floyd, feeling under his shirt and inside his pants pockets. He found nothing illegal. Testifying last week in federal court, Floyd said the incident left him feeling "frustrated [and] humiliated, because it was on my block where I live, and I wasn't doing anything."

Floyd's experience seems to be typical of the 5 million or so street stops recorded by the New York Police Department in the last decade. Police almost never discover guns, and nearly nine times out of 10 they do not make an arrest or even issue a summons. The class action lawsuit that bears Floyd's name persuasively argues that such unjustified harassment of innocent people violates the Fourth Amendment's ban on unreasonable searches and seizures.

The legal basis for the NYPD's stop-and-frisk program is supposed to be a 1968 Supreme Court decision arising from a police encounter quite different from the ones described by Floyd and the many other New Yorkers, overwhelmingly black or Latino, who are hassled by cops for no apparent reason every year. The case, Terry v. Ohio, involved a Cleveland detective who saw two men take turns walking back and forth in front of a store, peering into the window, about a dozen times, conferring with each other between trips.

The detective surmised that the two men were casing the store, which they planned to rob along with a third man who joined them later. Confronted by the detective, who asked for their names, the three men "mumbled something," whereupon the officer grabbed one of them and patted down his overcoat, finding a revolver in the breast pocket; one of the other men was also carrying a revolver in his overcoat. The Supreme Court said the detective's actions were consistent with the Fourth Amendment because he reasonably suspected that the men were engaged in criminal activity and that they were armed.

The track record of the NYPD's stop-and-frisk program suggests that its officers' suspicions of criminal activity are frequently less than reasonable, since they turn out to be right only 12 percent of the time. That impression is reinforced by the forms that officers fill out after these encounters, which rely heavily on all-purpose excuses such as "furtive movements" and "high crime area" to justify stopping people.

When she certified Floyd v. City of New York as a class action last year, U.S. District Judge Shira Scheindlin noted that in 2009 "officers listed no coherent suspected crime" on more than a third of the forms. She also observed that "for every sixty-nine stops that police officers justified specifically on the basis of a suspicious bulge [from 2004 through 2009], they found one gun."

As the number of stop-and-frisk encounters initiated by the NYPD grew from about 100,000 in Michael Bloomberg's first year as mayor to almost 700,000 in 2011, the share of stops yielding guns fell from 0.38 percent to 0.033 percent. Bloomberg says that trend shows the program is working, because "the whole idea…is not to catch people with guns; it's to prevent people from carrying guns."

If so, the policy is plainly inconsistent with the Supreme Court's Fourth Amendment rulings, which do not allow random searches aimed at deterring crime. It is telling that Bloomberg, confronted by the argument that his beloved stop-and-frisk policy is unconstitutional, responds by insisting that it works. Rights are not contingent on the effectiveness of the police tactics that violate them.