A federal judge on Monday threw out a plea agreement that would have given former Los Angeles County Sheriff Lee Baca a maximum of six months in prison, saying the sentence was too lenient considering Baca’s role in obstructing an FBI investigation into the county jails.

Addressing a downtown courtroom packed with Baca’s supporters, U.S. District Court Judge Percy Anderson said the deal “would trivialize the seriousness of the offenses … the need for a just punishment [and] the need to deter others.”

Baca, 74, had pleaded guilty in February to a single charge of lying to federal investigators. But the former sheriff’s involvement in trying to derail the investigation reached further than that, Anderson said.

At stake was what the investigators were trying to expose, Anderson said: an “us-versus-them” culture in which deputies covered up for one another and responded to inmates with enough violence to send them to the hospital.

Six months in prison for the man who ran the Sheriff’s Department “would not address the gross abuse of the public’s trust … including the need to restore the public’s trust in law enforcement and the criminal justice system,” Anderson said.

The judge said he would allow Baca to withdraw his guilty plea, setting a new hearing date for Aug. 1. The maximum sentence for the false statement charge is five years — the same amount of time that Baca’s former No. 2, Paul Tanaka, received last month after going to trial in a related obstruction-of-justice case.

Seven lower-ranking sheriff’s officials who have been convicted and sentenced in the obstruction case received a year and a half to more than three years in prison.

Baca’s plea agreement had called for a sentence ranging from probation to six months in prison. Prosecutors have said they agreed to the deal in part because of Baca’s willingness to plead guilty. Baca’s attorney, Michael Zweiback, argued that the former sheriff should not serve any prison time because he is in the early stages of Alzheimer’s disease. Baca interviewed by feds

Former L.A. County Sheriff Lee Baca admitted lying to federal prosecutors who questioned him about whether he was involved in attempts to obstruct an FBI investigation into the county jails. In this audio, assembled from a nearly four-hour recording, Baca is questioned by Assistant U.S. Atty. Brandon Fox.