That is when his colleagues were sent in for haircuts, for which the department paid $10 each, according to the records. The hope was that they would buy marijuana, or at least witness transactions.

It was unclear how many undercover investigators from the Internal Affairs unit got haircuts from the barber over that time, but police records indicate that there were at least four. (Undercover officers can decline any assignment, so they had the option of choosing not to return as repeat customers.) It was also unclear how many nonpolice customers, if any, got haircuts from the planted barber.

“The consensus was just that he gave bad haircuts,” one of the people briefed on the matter said. “They just didn’t like his haircuts.”

But the undercover barber, whose name was not made available, was never able to meet Officer Ramos, according to the affidavit and others filed in the case, as well as police records and the people briefed on the matter. Nor was he able to meet any of the other suspect officers, and only once in passing did he meet one of the drug dealers believed to be associated with the shop’s owner, according to the documents. He did not see any significant criminal activity, according to the documents.

As a result, Sergeant Valdez concluded that keeping the undercover barber in the shop was not productive.

“The use of an undercover police officer in furtherance of this investigation is, therefore, not feasible,” the affidavit said.

Paul J. Browne, the Police Department’s chief spokesman, would not discuss the barber shop and the efforts of the undercover officers there, saying, “The department does not disclose the details of undercover operations.” Despite the poor results, several people with knowledge of the matter said the idea to put the undercover officer in the barbershop was a good one. The shop itself has long since closed, replaced by a pharmacy.