The commissioner of the New York City police department views the controversial practice of stop, question and frisk as a means to instil fear in young African American and Latino men, a New York state senator testified in a federal court on Monday.

State senator Eric Adams, who retired from the NYPD after rising to the rank of captain during a 22-year career, said commissioner Ray Kelly described his views on stop and frisk during a July 2010 meeting in the office of then-governor David Patterson.

Adams had traveled to Albany for a meeting on 10 July 2010 with the governor to give his support for a bill that would prohibit the NYPD from maintaining a database that would include the personal information of individuals stopped by the police but released without a charge or summons. In discussing the bill, which ultimately passed, Adams said he raised the issue of police stops disproportionately targeting young African American and Latino men.

"[Kelly] stated that he targeted and focused on that group because he wanted to instil fear in them that every time that they left their homes they could be targeted by police," Adams testified.

"How else would we get rid of guns," Adams said Kelly asked him.

Adams told the court he was stunned by the commissioner's claim and immediately expressed his concerns. "I was amazed," Adams testified. "I told him that was illegal."

According to Adams, also at the meeting were a former New York City council member, Hakeem Jeffries, who is now a US congressman, and another New York state senator, Martin J Golden. Adams said he was "shocked" the commissioner would describe an effort to instill fear among African American and Latino youth in the company of three elected African American politicians – referring to himself, Jeffries and Golden.

Adams's testimony marked the latest in a series of explosive allegations leveled against the NYPD in an ongoing trial targeting the department's stop-and-frisk practices. In earlier hearings, two serving NYPD officers testified that the department maintains a rigid quota system to ensure officers make a certain number of stops, arrests and summons. Both men secretly recorded roll-call meetings and conversations with supervisors which purport to show the existence of such a system.

Under the joint tenure of Kelly and mayor Michael Bloomberg, the NYPD has stopped and, in some cases searched, approximately 4.4 million people, most of them Latino or African American.

By law, police officers are empowered to stop individuals on the street if they have reasonable suspicion that an individual is preparing to, is in the process of, or has just committed a crime.

According to Adams, under these conditions, stop and frisk is a "great tool" for suppressing and responding to crime. He added, however, that "nowhere" in the law is an officer empowered to "use the tool to instil fear. Nowhere".

Heidi Grossman, an attorney for the city, challenged Adams on the facts of his meeting with Kelly, noting the state senator had not provided notes on the conversation, despite a subpoena. Adams said his email inbox contained some 10,000 messages and that his search for notes concerning the meeting was ongoing.

"I don't think anyone in their right mind would believe the police commissioner would say the police department is targeting, just for targeting, blacks and Hispanics," Grossman said.

She added that commissioner Kelly has denied telling Adams that stop and frisk is intended to instil fear in minority populations.

David Floyd is the lead plaintiff in the class-action lawsuit against the city of New York over its stop-and-frisk practices. Photograph: Lucas Jackson/Reuters

In October 2011, Adams signed an affidavit in support of class action certification for the Floyd suit. Grossman confirmed that Adams met with attorneys filing the suit before he signed the affidavit and suggested it was drafted by the the plaintiffs' attorneys. Adams said he was unaware of how the affidavit came into being and said it may have been drafted by one of his staffers. Grossman pointed out that the document uses the phrase "instil the belief", with respect to Kelly's comments to Adams, rather than "instil fear".

The same month, Adams also described the meeting with Kelly to the Guardian. At the time, Adams said the commissioner told him the aim of the practice was to "instil in every young man from those communities [black and Hispanic] that any time they leave their house they can be searched by the police."

Asked whether Adams' October 2011 comments had given an accurate account of Kelly's remarks NYPD spokesman Paul Browne told the Guardian at the time: "commissioner Kelly said he wants gunmen to be deterred from carrying weapons on them in the streets, particularly in those communities most victimised by gun violence."

In court on Monday, Grossman attempted to read from an affidavit signed by Kelly in 2011 in which Kelly apparently rejected Adams' claims, but judge Scheindlin shut the effort down, stating that the commissioner would not be able to provide testimony through "backdoor" means. "If he'd like to come here, he's welcome in this courtroom," Scheindlin said. "If he's not going to be here we're not going to have his statement."

Kelly said in a statement later that he "categorically and totally" denied making the remarks attributed to him by Adams. "It's interesting that apparently only Mr Adams heard this statement though other people were present. And, it just defies logic ... it's ludicrous."

Adams's Brooklyn district contains some of the most heavily policed areas in New York City, including Brownsville, which in 2011 reported the second highest number of stops in the city. The neighborhood also has some of the highest crime rates in the city. Adams told reporters outside court that young people simply trying to survive in his district frequently find themselves trying to avoid both crime and police harassment.

"They feel trapped," Adams said. He described a meeting in his office approximately a year and a half ago when seven high school football players came in to describe police stops they had experienced.

"Two of them began to cry," Adams said, adding that the boys told him about "police touching their privates."

"Cops don't want to do this," he said. "Cops are so frustrated they are wearing wires to roll call."

Adams said he is at times frustrated with his own ability to convey the seriousness of conditions in his district to residents in New York's more affluent neighborhoods. "It pains me," he said. "New Yorkers don't really know how bad it is for young people."