Former Los Angeles Sheriff Lee Baca has pleaded guilty to federal charges of lying to investigators, the culmination of a years-long investigation into abuses by jailers that ended up focusing on the cover-up and resulted in the indictment of over a dozen officials and deputies.

The investigation, which put an early end to Baca's career, could end with him spending time in federal prison. Baca is scheduled to be sentenced May 16. According to a plea agreement with federal prosecutors, he could face up to six months in prison.

“Today’s charge and plea agreement demonstrate that illegal behavior within the Sheriff’s Department went to the very top of the organization,” United States Attorney Eileen M. Decker said, reading a prepared statement at a press conference Wednesday.

She added that her office wasn't celebrating: "It is indeed a sad day when a leader of a law enforcement agency fails to honor his oath and instead of upholding justice chooses to obstruct it."

Baca is "somber but in a good mood," his attorney, Michael Zwieback said Wednesday.

"He believes this is part of his life's journey and that it's time to put this behind him," Zweiback said and "doesn't want the men and women of the sheriff's department to continue to be under this cloud."

He said in exchange for the guilty plea, prosecutors agreed not to charge Baca with obstruction of justice, a more serious crime.

According to the plea deal, Baca "knowingly and willfully made a material false and fictitious statement and representation" on April 12, 2013 regarding his deputies' dealings with an FBI agent.

Sheriff's deputies approached the agent – who was part of a team investigating allegations of inmate abuse in the jails – outside her home and threatened to arrest her. Federal investigators said the interaction was an attempt to intimidate the FBI.

According to the court documents, the charges come from Baca's statement to investigators he "was not aware" deputies planned on approaching the agent, and had no knowledge of the exchange until an FBI official called him to complain.

"In fact," the agreement states, not only did he know it was going to happen, he directed the deputies to "do everything but put handcuffs" on her.

Current Sheriff Jim McDonnell, who was traveling out of town Wednesday, issued a statement saying the waves of prosecution of Sheriff's deputies and officials have been "difficult" but that the department remains "focused and committed to moving forward."

The prosecution stems from a long-term federal investigation into civil rights abuses and corruption in the largest county jail system in the country.

Federal investigators looking into abuses in the jail smuggled a cellphone into an informant at the jail. When Baca found out about it in August 2011, according to the plea deal, he asked ordered the inmate isolated and asked federal prosecutors to work with him and not the FBI.

At the same time prosecutors allege deputies tried to hide the FBI jail informant from his handlers for two weeks by shifting him from cell to cell at various jails under different names and altering jail computer records. The FBI wanted the informant to testify to a grand jury.

At least 17 sheriff's officials have been implicated in the FBI's investigation and the plot to obstruct it.

Seven other former Sheriff’s officials already have been convicted of participating in the elaborate effort to erase the inmate’s name from computer records and hide him in a remote jail facility in San Dimas.

Former Undersheriff Paul Tanaka has been accused of orchestrating the scheme. He is scheduled to go on trial March 22. In a trial of multiple deputies, Tanaka testified for the defense that he was barely involved and was following Baca's orders that he thought were lawful.

Baca stepped down as sheriff in 2014 under pressure from the mounting jail scandals.

In the past, Baca said any movement of the inmate was take solely to protect him from deputies who might retaliate against him for being an FBI informant. The former sheriff has consistently denied any wrongdoing, until now.

Former federal prosecutor Miriam Krinsky, who headed up a county commission tasked with investigating violence in the jails, called the guilty plea a "tragic end to a long career that had so much good associated with it."

She said Baca was among the first law enforcement leaders in the United States to acknowledge the country's over-reliance on incarceration.

"He was very passionate about those issues," she said.

Yet that idealism was hard to reconcile with some of the abuses inside Baca's jails.

"There had been evidence over time of mistreatment of individuals," she said. "I think he simply allowed that misconduct to occur and too often looked the other way or simply delegated leadership to others."

Diana Zuniga of Californians United for a Responsible Budget, has raised allegations of violence in the jails for years. She said "on paper" at least, violence inside the jails has gone down since Baca left.

But she chided McDonnell for being less accessible to the public and to activists than Baca, who frequently met with critics.

Wednesday's plea deal, she said, was a welcome acknowledgement of "lies" that have been perpetuated for years.

"How many times does law enforcement lie to protect its own?" she asked. "It's not an isolated incident."

Krinsky said McDonnell's zero-tolerance policy for lying on the job has been the biggest step aimed at changing the culture of the department.

This story has been updated.

View the charges and plea deal:

Document: Plea deal for Lee Baca

Document: Charges against former Sheriff Lee Baca