JERSEY CITY

— A suit filed against Jersey City and the police chief by officers who say their rights were violated when they were tested for steroid use has been dismissed by a Superior Court judge.

The steroids issue arose from a New York Police Department probe into a Brooklyn pharmacy that was raided in 2007, uncovering sales of more than $8 million worth of performance-enhancing drugs in a probe into steroid use among NYPD officers.

The suit filed by officers Nicholas Kramer and Brian McGovern in state court is similar to one previously filed in federal court by Kramer, McGovern and officers Patrick Fay, John Bado, Stefano Petrillo, Michael Stise and Victor Vargas. The federal suit was dismissed by a District Court judge and an Appellate Court upheld the dismissal in late 2011.

Jersey City Police Chief Tom Comey learned that as many as 50 city police officers were receiving steroids from the pharmacy, according to the federal Appellate Court ruling. He acted quickly to ensure that officers were not using steroids that would make them dangerous and unfit for duty, according to the federal ruling.

The officers alleged their right to be free from unreasonable search and seizure had been violated by the drug testing and that they had been discriminated against based on the medical conditions for which the drugs had been prescribed.

In her ruling, state Superior Court Judge Lourdes Santiago said she found Comey’s actions were justified and that he was also entitled to immunity for his actions, a city Law Department official said yesterday.

All seven officers listed as plaintiffs in the federal suits were placed on modified duty in 2008 after testing positive for prescribed steroids. All have since returned to regular duty.