For more than 40 years, criminal defendants in California have had a right to find out if police testifying against them have a record of lying, excessive force or any other misdeeds that cast doubt on their credibility. But a new state appeals court ruling could remove a bridge to that information in a number of counties, including San Francisco, Alameda and Santa Clara.

The case comes from Los Angeles County, where the Sheriff’s Department compiled a list of about 300 deputies with records of misconduct that might be used against them on the witness stand. The Sheriff’s Department planned to turn the list over to the district attorney so it could notify a defense lawyer if one of the deputies was called as a witness, leading to a closed-door judicial hearing on possible disclosure of the records.

In a 2-1 ruling Monday, the Second District Court of Appeal in Los Angeles said police personnel files are confidential under state law and cannot be revealed to the district attorney or anyone else unless a judge in a criminal case grants a defense request to review the records and then authorizes disclosure.

Otherwise, any disclosure of a law enforcement officer’s record, even to a prosecutor, would potentially “cause stigma and irreparable harm to the individual” and is forbidden by law, the court said.

Similar lists of law enforcement officers have been compiled and turned over to prosecutors’ offices in at least a dozen counties, including San Francisco, Alameda, Santa Barbara and San Luis Obispo. Officials in those counties said they were following strict procedures for personnel access established under a 1978 state law.

The state attorney general’s office approved such a list for California Highway Patrol officers in 2015. The ruling, if it stands, would abolish the practice.

The San Francisco district attorney’s office has kept a list of police officers and deputies with records of misconduct since 2010 and contacts defense lawyers if anyone on the list is a prospective witness. “We want every person to have a fair criminal proceeding and a fair trial,” said Alex Bastian, spokesman for District Attorney George Gascón.

The ruling “will make it more difficult for individuals accused of a crime to obtain evidence that is relevant to their defense,” said Melanie Ochoa, an American Civil Liberties Union attorney who supported Los Angeles County’s defense of its decision to compile the deputies’ records.

But Elizabeth Gibbons, a lawyer for the Association for Los Angeles Deputy Sheriffs who argued against the disclosures, said defendants will still be able to see police records in appropriate cases, only without assistance from the prosecutor.

“It doesn’t change anything,” she said. “It just protects the already existing rights of the officers.”

The Sheriff’s Department in Los Angeles said it is reviewing the ruling. The office could seek review by the state Supreme Court — which, in a 2015 decision, spoke favorably of San Francisco’s procedures without deciding their legality.

The compilations are known as “Brady lists,” named for the 1963 U.S. Supreme Court ruling that required prosecutors to turn over any evidence they had that might help to clear a criminal defendant.

The impact of that ruling was initially limited in California by state laws, backed by powerful police organizations, that kept officers’ personnel files confidential. But a 1974 California Supreme Court ruling, in a case known as Pitchess, entitled defense lawyers to information about misconduct in an officer’s recent past that might affect his or her credibility as a witness.

Under the decision, which the Legislature wrote into state law four years later, a defendant who claimed an officer was lying, for example, could obtain information that the officer had been prosecuted or disciplined for fabrications in the previous five years. Evidence about bigotry or brutality during the same period can also be disclosed when relevant to the officer’s testimony.

The defense lawyer must file a request, known as a Pitchess motion, that describes why a specific officer’s records could contain information that would affect the jury’s assessment of his or her testimony. A judge who grants such a request then reviews the records in private and decides what to turn over — usually just the names and contact information of those who have filed successful complaints against the officer, but sometimes the records themselves.

Those procedures are still available. But last week’s ruling would eliminate an option in counties such as San Francisco that aids defendants by informing their lawyers when an officer has a record of misconduct, and by adding the prosecutor’s support to the request for police records.

The state Supreme Court looked at San Francisco’s procedures in a 2015 case that involved a narrower question: whether the examination of an officer’s personnel record should be done first by the Police Department or the district attorney. The court said unanimously that only police could access the confidential files.

But the justices also said the Police Department had “laudably established procedures to streamline the Pitchess/Brady process” by sending relevant information to the district attorney’s office for further review, and possible addition to the office’s “Brady list.” The Supreme Court did not decide whether the list itself was legal, however, and the Los Angeles appeals court was unswayed by the commendation.

“Such brief comment ... is not the same as formal legal approval,” the appeals court majority said before prohibiting the Sheriff’s Department from relaying the records to prosecutors.

Teresa Drenick, spokeswoman for Alameda County District Attorney Nancy O’Malley, said her office believes the appellate decision “is inconsistent with the spirit of the (state Supreme Court) ruling.”

Stanford Law Professor Robert Weisberg, co-director of the school’s Criminal Justice Center, predicted the issue would again reach the state’s high court, which would have to decide whether the state’s confidentiality laws interfered with a defendant’s constitutional right to a fair trial.

He said the same issue is brewing in other states and could reach the U.S. Supreme Court.

Bob Egelko has been a reporter since June 1970. He spent 30 years with the Associated Press, covering news, politics and occasionally sports in Los Angeles, San Diego and Sacramento, and legal affairs in San Francisco from 1984 onward. He worked for the San Francisco Examiner for five months in 2000, then joined The Chronicle in November 2000.

His beat includes state and federal courts in California, the Supreme Court and the State Bar. He has a law degree from McGeorge School of Law in Sacramento and is a member of the bar. Coverage has included the passage of Proposition 13 in 1978, the appointment of Rose Bird to the state Supreme Court and her removal by the voters, the death penalty in California and the battles over gay rights and same-sex marriage.