The New York City Police Department has a long history of violating constitutional rights by stopping, questioning or frisking people on the streets without legal justification. The city has steadfastly denied that the detentions — made under its increasingly unpopular stop-and-frisk program — have been based on race.

But that claim is being challenged in Floyd v. the City of New York, a federal class-action trial in Manhattan, where witnesses including police officers are arguing that the department does, in fact, use race as the basis for stopping and frisking hundreds of thousands of citizens a year.

This week, the court heard a troubling recording secretly made last month by Officer Pedro Serrano, of the 40th Precinct, in the South Bronx. Mr. Serrano is one of a handful of officers who began tape-recording conversations with their colleagues or superiors to document what they saw as wrongdoing.

In the recording, Deputy Inspector Christopher McCormack is heard urging Mr. Serrano to stop, question and, if necessary, frisk “the right people at the right time, the right location.” When Mr. Serrano asked for clarification about who the “right people” were, the inspector replied: “The problem was, what, male blacks.” He continued, “And I told you at roll call, and I have no problem telling you this, male blacks 14 to 20, 21.”