Former Baton Rouge police Cpl. Donald Bailey was sentenced Tuesday to three years in prison for shaking down a Parish Prison inmate in 2009.

Bailey, who pleaded no contest in May to bribery and corrupt-influencing charges, was accused of soliciting and accepting cash from the prisoner.

“I’d like to apologize to the court and my family for this whole situation,’’ Bailey, 51, told state District Judge Chip Moore shortly before he was sentenced.

Bailey’s attorney, Mike Walsh, asked Moore to follow a probation officer’s report, which said Bailey was eligible for probation.

Assistant State Attorney General Butch Wilson, however, called Bailey’s conduct “outrageous.”

Bailey “endangered the public,’’ Wilson said. “A message has to be sent.”

Moore acknowledged the “serious nature’’ of Bailey’s actions. He said such conduct causes the public to lose trust in the criminal justice system.

Moore sentenced Bailey to three years in prison on the bribery charge and five years on the corrupt-influencing charge, both charges to run consecutively. He suspended the five-year term and said Bailey will be on probation for five years after his release from prison.

The judge also ordered Bailey to perform 325 hours of community service, speaking to students, police agencies, and others.

“I think the sentence reflects the seriousness of this case,’’ Assistant Attorney General David Caldwell said after court.

Bailey’s no-contest plea resulted from a sting operation by East Baton Rouge Parish District Attorney Hillar Moore III, State Police and the Baton Rouge Police Department.

Bailey was a 14-year veteran of the police force and coordinator of the Targeted Violent Offender Program when he resigned from the department in October 2009.

State Police arrested Bailey on Sept. 28, 2009, after he was videotaped accepting $1,400 from Gregory Lollis.

Lollis was in the custody of the East Baton Rouge Parish Sheriff’s Office on a cocaine possession charge and a parole hold in September 2009 when detectives arranged for him to make a recorded telephone call to Bailey from Parish Prison.

Lollis told Bailey he needed help getting out of jail, State Police have said.

Prosecutors said Bailey agreed to assist Lollis, and told him he would have the charges dismissed and the parole hold lifted in exchange for $12,000.

Bailey contacted the District Attorney’s Office and the state Office of Probation and Parole to request the dismissal of the charges and the lifting of the parole hold, State Police said.

Bailey also directly approached Hillar Moore, who immediately contacted authorities, prosecutors said.

Working with detectives, the District Attorney’s Office and the Office of Probation and Parole allowed the charges to be dropped and the parole hold lifted, State Police said.

Once Lollis was released, State Police detectives arranged for him to meet Bailey on Sept. 28, 2009.

Bailey was arrested later that day at police headquarters.

A no-contest plea has the effect of a guilty plea in criminal court but cannot be used as an admission of guilt in civil court.

Lollis is suing Bailey in federal court, claiming Bailey fabricated theft and drug charges against him.