New York (CNN) Two former New York detectives will serve no prison time after pleading guilty to bribe taking and official misconduct for having sex in a police van with a young woman they arrested and released, prosecutors said Thursday.

Prosecutors had requested that Eddie Martins, 39, and Richard Hall, 34, receive sentences ranging from one to three years in prison, Brooklyn District Attorney Eric Gonzalez said in a statement.

But State Supreme Court Justice Danny Chun indicated each defendant will be sentenced in October to five years probation, according to Gonzalez. The plea agreement was offered by the court -- without prosecutors' consent -- because the defendants pleaded guilty to the entire indictment, the district attorney said.

In court, the judge said he agreed to probation because prosecutors had demonstrated that violent felony counts against the defendants -- including rape charges that were eventually dismissed -- couldn't be proven beyond a reasonable doubt.

"The credibility of the victim, or the complainant, in this case was seriously, seriously questionable, at best," said Chun, according to a court transcript obtained by CNN.

While scientific evidence in the case was "very compelling," Chun said there was a possibility of a jury convicting only on the misdemeanor charges. The offer of probation without jail time was not "unjust or unfair" since the former officers had resigned from their jobs and had accepted felony convictions with their pleas, the judge said, according to the transcript.

Chun expanded on his reasoning for the plea deal, arguing that by law, their accuser could be charged for offering a bribe to the two former police officers.

"The other party offering a bribe could also be charged... which is the same level of felony as bribe-receiving," Chun said, according to the court transcript. "Given that there are criminal activities on both sides, however, there is one critical difference here: both the defendants before me are police officers and police officers are sworn to uphold a higher standard of ethical code, behavior or higher standard, period, than other people engaged in criminal activity."

The ex-officers were originally arraigned on 50 counts, including first-degree rape

JUST WATCHED Detectives charged with raping woman in van Replay More Videos ... MUST WATCH Detectives charged with raping woman in van 01:13

The former officers pleaded guilty Thursday to two counts of bribery in the third-degree and nine counts of official misconduct, the district attorney said.

Martins and Hall were originally arraigned in November 2017 on 50 counts , including first-degree rape, first-degree criminal sexual act and second-degree kidnapping, prosecutors said.

"These defendants engaged in a shocking abuse of power, which they finally acknowledged," Gonzalez said. "While I would have preferred to see them serve prison time, they are no longer members of our police department and with today's plea are convicted felons."

The district attorney said the case resulted in New York passing a law prohibiting police officers from having sex with people in custody, closing a loophole that allowed police to claim the sex was consensual.

"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," Gonzalez said.

The woman's attorney, Michael N. David, said the sentence was unacceptable and sent a bad message to victims about police violence.

"We're outraged. It's complete injustice what happened today. You can't consent when you're 5'3, 100 pounds and they're both over 6 feet and very muscular. They had her in handcuffs. These cops got a free pass," he said.

The attorney said he will represent the woman in a federal lawsuit against the city and will ask the US Attorney for the Eastern District of New York to prosecute Martins and Hall.

Defense lawyers say case could have been resolved long ago

Martins' attorney, Mark Bederow, called the plea agreement "a fair outcome." He said the case was "botched horrifically" by prosecutors following "the political climate at the time" rather than the "credible evidence."

"Let me be clear, I'm not criticizing the 'Me Too' movement. I'm criticizing the DA's office," he told CNN. "They had evidence that the victim had repeatedly lied under oath about virtually everything and, rather than presenting that evidence, they -- given the climate -- brought forth first-degree rape charges."

Peter Guadagnino, Hall's attorney, said, "We could have resolved this case over a year and a half ago with the same plea, if they were charged properly from the beginning."

"The injustice was the DA's office positioning this as a rape case," he said. "My client has been called a rapist all this time. He did take a bribe, and I won't talk that down, but he never raped anyone."

The district attorney's office declined to comment beyond its earlier statement.

Prosecutors dismissed the rape charges earlier this year, citing credibility problems. The district attorney, in a letter to the court in January, said the woman "made a series of false, misleading and inconsistent statements about the facts of this case."

The detectives' DNA was recovered from the woman, prosecutor says

The former detectives voluntarily resigned from the NYPD in November 2017. They later pleaded not guilty to all counts, prosecutors said.

At the time, Martins was released on $250,000 bail and Hall was released on $150,000 bail. Each faced up to 25 years in prison if convicted of the more serious charges.

The former officers were assigned to the Brooklyn South Narcotics squad at the time they were accused of taking turns raping the handcuffed 18-year-old woman in the back seat of their police van in Coney Island in September 2017, prosecutors said.

They were on-duty in a Dodge Caravan as part of a team of plainclothes detectives conducting a buy and bust operation, according to the district attorney.

Prosecutors said the defendants left their post without authorization and later stopped a car driven by the 18-year-old woman, who was accompanied by two male passengers, Gonzalez said in the statement.

The detectives handcuffed and arrested the woman after she told them she had marijuana and two Klonopin pills, the statement said. The two passengers were allowed to leave.

The district attorney said the woman had sexual intercourse with Martins and performed a sex act on Hall. The defendants later released the woman and returned the pills to her. They did not report the incident.

Their DNA was recovered from the woman and surveillance video showed her leaving the van about 40 minutes after she was picked up, Gonzalez said.