SACRAMENTO, Calif. (AP) — The California Supreme Court on Monday expanded rules for telling suspects that they’ve been arrested by a police officer who has previously been accused of taking bribes, tampering with evidence or witnesses, lying or using excessive force.

The justices ruled that a suspect’s right to a fair trial outweighs the privacy rights of officers who might have a history of bad behavior.

Justices rejected a lower court ruling that barred the Los Angeles County Sheriff’s Department from giving prosecutors the names of deputies accused of improper conduct.

“The importance of a fair trial to a criminal defendant is paramount to our justice system, and this reinforces that,” said attorney Geoffrey Sheldon, who argued the case on behalf of the department.

Longstanding U.S. Supreme Court rulings require prosecutors to share that background with defendants, who can then use it to argue that they were framed or otherwise harmed by rogue officers.

But California has some of the nation’s tightest privacy rules involving law enforcement officers.

The justices noted that a new law requiring more public disclosure of police misconduct means some police records are no longer confidential.

The law requires public access to records if an officer has been found by the agency that employs them to have improperly used force or discharged firearms, committed sexual assaults on the job, or has been dishonest in official duties.

Some officers manage to stay on the force — even if violations are sustained by their department — if the conduct was not criminal, prosecutors declined to file charges or officers were not convicted.

Some can keep their jobs even with certain criminal convictions. Others appeal their discipline and are reinstated.

Law enforcement unions have tried unsuccessfully to block public disclosure of records from incidents that took place before this year, arguing that the law shouldn’t be retroactive.

The Association of Los Angeles (County) Deputy Sheriffs argued that disclosure of so-called “Brady lists” also violated deputies’ due process rights.

The list “is a direct product of a flawed disciplinary process,” union officials said in response to the court’s ruling. “This flawed disciplinary process, which may be filled with bias, grudges, faulty analysis and outright misrepresentation, has plagued the Sheriff’s Department for decades.”

The California District Attorneys Association said 22 of the state’s 58 counties have adopted disclosure policies, though some provide prosecutors with a full list while others disclose the name only when a specific officer is subpoenaed to testify in a particular case.

The justices said officers’ names can be disclosed to prosecutors only when they are relevant to a particular case, with no blanket disclosure.

The name of the list stems from a 1963 U.S. Supreme Court ruling, Brady vs. Maryland, that prosecutors must disclose any evidence in their possession that might help defendants.

Eleven years later, the California Supreme Court decided that evidence can include information from a peace officer’s otherwise confidential personnel file. But to get it, defendants must show “good cause” in each case and a judge must privately review the officers’ records before releasing any relevant information.

It is not a violation of confidentiality to disclose to prosecutors that an officer is on the Brady list even if the underlying records are confidential, the high court ruled. Prosecutors can then ask the court to review the officers’ file and release any pertinent details.

“In this context, construing the … statutes to cut off the flow of information from law enforcement personnel to prosecutors would be anathema to Brady compliance,” said the opinion written by California Supreme Court Chief Justice Tani Cantil-Sakauye, whose husband is a retired Sacramento police lieutenant.

The Los Angeles County Sheriff’s Department compiled a list of about 300 deputies whose names it intended to send to prosecutors, though it said their actual records would not be disclosed without a judge’s order. The department has about 7,800 deputies.

The deputies’ union sued to block the department from releasing the list, arguing in part that prosecutors are only obligated to disclose what they learn in their own investigations. It’s up to defendants to seek deputies’ background information, the union argued.