2 former NYPD detectives plead guilty to charges they had sex with suspect in police van originally appeared on abcnews.go.com

Two former New York City police officers pleaded guilty Thursday to charges of misconduct and receiving a bribe after the pair said they had sex with an 18-year-old drug suspect in the back of a police vehicle in exchange for releasing her.

Richard Hall and Eddie Martins pleaded guilty on Thursday to two counts of third-degree felony bribe-receiving and nine counts of misdemeanor official misconduct during an unscheduled hearing in Brooklyn Supreme Court. Justice Danny Chun agreed to accept their guilty pleas in exchange for five years of probation over the prosecutor's request for one to three years in prison.

Chun slammed the two detectives and the female suspect for engaging in "criminal activities."

Jury selection in the trial for the former officers was slated to begin on Sept. 9. Had they gone to trial and been convicted, they would have faced up to seven years in prison.

(MORE: Charges dropped against ex-NYPD officers accused of raping a teen in custody)

Hall, 34, and Martins, 39, were initially indicted on felony rape and other charges, but prosecutors dropped the chargesin March and presented their case to a new grand jury, which indicted them on bribery and official misconduct charges.

When the prosecutors dismissed all the violent felony charges, they had "clearly shown to this Court that the violent felonies could not be proven beyond a reasonable doubt," said Chun. "The credibility of the victim, or the complainant, in this case was seriously, seriously questionable, at best. Also, by putting that complainant in the Grand Jury, that witness most likely obtained immunity except for potential perjury charges."

Both officers resigned from the NYPD shortly after they were indicted in November 2017.

PHOTO: New York City police detectives Edward Martins, left, and Richard Hall, right, are escorted out of Kings County Supreme Court in Brooklyn, Oct. 30, 2017. (Dave Sanders/The New York Times via Redux, FILE) More

Martins' attorney, Mark Bederow, told ABC News that the rape charges were only brought by the prosecutors due to the pressures of the #MeToo movement.

"We repeatedly told them of the evidence that she was lying, which was their own evidence," said Bederow. "They rolled their eyes at us for over a year and a half. The prosecutors botched the investigation and tried to please the public outcry and that's not what prosecutors are supposed to do."

In September 2017, Hall and Martins were assigned to the NYPD’s Brooklyn South Narcotics unit when they arrested an 18-year-old drug suspect. The pair admitted to Chun on Thursday that they took turns having sex with her in the back of the police van as they drove through Bay Ridge and Coney Island in exchange for releasing her, and that they did not report the arrest to their superiors.

(MORE: 2 NYPD officers accused of sexually assaulting handcuffed woman quit before hearing)

"As a result of this disturbing incident, New York passed a law to prohibit police officers from having sex with people in their custody, closing a loophole that had allowed officers to claim the sex was consensual," said Brooklyn District Attorney Eric Gonzalez in a statement. "We could not apply the new law retroactively, and serious credibility issues in this case precluded us from proceeding on additional charges, yet we remained committed to holding these defendants accountable."

Assistant District Attorney Frank DeGaetano objected to the probationary sentencing offered by the judge. Chun felt it was "appropriate" to give the prosecutors a reason for his decision, which was based on the history of the case.

Chun said the felony bribe-receiving charges would have made sense if this was an undercover sting operation, adding that he only foresaw a jury convicting Hall and Martins of the misdemeanor misconduct charges.

The victim of the sexual assault revealed herself under the pseudonym "Anna Chambers" and has a pending $50 million civil rights lawsuit against the city and her assailants.

"This is outrageous that they can rape my client and not serve any jail time," Chambers' civil attorney, Michael David, told WABC over the phone.

David said he intends to seek federal civil rights charges against the former officers.