A regular $20 break on the usual $40 charge at an outer borough brothel was the sole reward two cops allegedly received for providing information to a multimillion-dollar prostitution and gambling operation.

“Discounted sex,” Assistant District Attorney Bradley Chain told Judge Leslie Leach in Queens Supreme Court on Thursday.

Chain explained, “Instead of paying $40, [the cop] would ‘give the girl $20’ and the house would not take a cut. That is the quid pro quo.”

First NYPD Sergeant Carlos Cruz and then Police Officer Giancarlo Raspanti had been brought in from the holding cell in handcuffs, two of the seven cops arraigned for protecting the organization. They were both freed without bail, leaving people marveling that they had likely thrown their lives away for a $20 discount on a stained mattress with a hooker.

But after the ridiculous came a chill of evil to match or even surpass police corruption of the bad old days.

Detective Rene Samaniego was brought before the judge as maybe the first active-duty New York cop charged with deliberately placing fellow officers in danger even as he was working with them.

“He in his position in Brooklyn South Vice as a detective assigned to Brooklyn South Vice, was actively in charge and charged with the duty of doing enforcement on both gambling and prostitution,” the prosecutor began. “As positioned that way, he was in a unique spot to be able to provide information of the exact nature of the criminal activities that were taking place in both gambling and prostitution in these two indictments.”

That was about what might be expected of a crooked cop, as was what the prosecutor said next:

“Over the course of this investigation, we learned that Detective Samaniego was actively providing tips on police enforcement in terms of search warrants that were going to be executed, undercover operations that were going to be taking place, in terms of confidential informant operations that were going to be taking place, and generalized enforcement of anything that was going to have anything to do with these brothels or gambling holes.”

Then came the shock.

“This defendant provided descriptions of the undercovers that were going to be entering, as they were entering,” the prosecutor charged. “He was present on the scene as part of the field team in many of these operations and was giving play-by-play instructions to the organization regarding what officers were coming at what time, what they were wearing, what their race was, where they were coming from.”

The prosecutor went on, “As being positioned in the van, either the prisoner van or the leader car, he had access to the radios, knowing exactly when the undercovers were going to be stepping in.”

The Internal Affairs Bureau (IAB) had been investigating Samaniego and the others for months and had secured a warrant to tap his phone. They had listened as he spoke to undercovers, then immediately called the retired detective who allegedly headed the organization.

“[Samaniego] personally was in phone contact, which was intercepted on the wire, with these undercover detectives as they were going to the location and getting reports back immediately about when these steps were going to take place.”

“ Instead of paying $40, [the cop] would ‘give the girl $20’ and the house would not take a cut. That is the quid pro quo. ” — Assistant District Attorney Bradley Chain

The prosecutor recounted an incident in which honest cops had arrested a prostitute at the organization’s brothel in Sunset Park, Brooklyn. Samaniego had learned the Human Trafficking Bureau at the Brooklyn district attorney’s office was looking into the case.

“Upon discovering that Human Trafficking was interested in a simple prostitution arrest, he immediately leapt into action, reporting to the organization exactly what he was told to the point… that the intelligence from the Kings County District Attorney's Office investigation [that] was provided to him was then provided immediately to the organization.”

The organization had then communicated with the prostitute who had been arrested, providing her with a script to recite while still in custody to the Human Trafficking Bureau so as to misdirect its investigation, the prosecutor said.

“This conduct was egregious,” the Queens prosecutor said in summing up Samaniego’s action. “It is far beyond any of the other officers that are charged here today.”

The prosecutor alleged that Samaniego was rewarded with periodic payments of $500. The prosecutor then asked the judge to set bail at $100,000. The prosecutor noted that Samaniego is a native of Ecuador and has traveled outside the United States in the past, the suggestion being he might choose to skip a trial.

Rather than try to minimize the charges, Samaniego’s lawyer John Arlia sought to portray his client as someone who was unlikely to flee.

“He is 47 years old,” the lawyer said. “His wife and his brother, a doctor, are present here, have retained counsel immediately… He is a naturalized citizen since he is 18 years old. He has lived in the same area of Queens his entire life, has a daughter in Hunter College.”

Samaniego stood impassive in a gray T-shirt, gloomy but seeming not at all ashamed to be accused of such monstrous betrayals. He had been silent save when a court officer asked if he was right- or left-handed.

“Right,” Samaniego replied.

The court officer uncuffed Samaniego’s right wrist so he could sign a waiver to having the charges read aloud. The court officer then re-cuffed him until the judge announced that Samaniego would be released on his own recognizance, as were all seven cops.

That brought a scowl from Ira Judelson, who is sometimes called the bail bondsman to the stars. He had come with some expectation his services might be needed.

“If it was you or me, there would be bail,” he said.

After a lunch break, the court officer brought in 20 civilians in handcuffs. They included Ludwig Paz, a retired NYPD vice detective who allegedly headed the prostitution and gambling organization. He sat staring straight ahead in a black shirt, absently jiggling his right foot, the sneaker loose, as the laces had been confiscated.

Farther down the bench sat Paz’s wife and stepdaughters. The wife, Arelis Peralta, began to sob and slumped to the floor. Three female IAB detectives and a female IAB sergeant moved to help her up.

“Peralta, come on,” a detective said, placing a reassuring hand on her.

They helped her past where Paz sat, and he gave an anxious look and looked for a moment like he might rise.

“Relax,” the IAB sergeant told him.

Years ago, a woman had burst into tears in this very same courtroom while her husband was sentenced on a robbery charge. A court officer famously asked, “Lady, did you cry when he bought home the money?”

One difference now was that Peralta was herself charged. She was brought back in to rejoin the other defendants a few minutes later, looking drained but composed.

One of the stepdaughters, Jafelis Guzman, stood before the judge. Her lawyer said she has worked as a security guard and at T-Mobile. The prosecutor said she was an active member of the prostitution and gambling operation.

The prosecutor said the same about the other stepdaughter, Arisbell. The lawyer said she is a student at LaGuardia Community College and also training to be a flight attendant for Delta Air Lines.

Both young women were released without bail. Arisbell paused to check on her mother and gave her stepfather a quick embrace.

When the mother’s turn before the judge came, she was allowed to sit. The prosecutor described her as “one of the central lynchpins of this organization, both prostitution and gambling.” The prosecutor said she was involved in staffing and making sure people were paid on time and guaranteeing profits stayed up.

“If the numbers were down, she had the ability to fire people and did so,” the prosecutor said. ”She’s clearly in control.”

As with all the defendants on Thursday, her lawyer insisted she was innocent.

“There will be no reason to believe this is the kingpin, the queenpin,” the lawyer said.

The judge set bail at $150,000 cash. She proved also to be right-handed when she was uncuffed to sign a waiver, her red fingernail polish looking incongruously cheerful. Her right wrist was re-cuffed and stayed so along with the left as she was led off to the holding cells, to remain in custody until she can post bail.

Paz became the fourth and last member of the family to be arraigned. The prosecutor said Paz had applied the principles of good business to being a bad guy.

“And attention to details,” the prosecutor said. "Making sure the clients are happy, making sure the staff is happy.”

There was one challenge unique to his particular business.

“Making sure there were enough prostitutes at a location,” the prosecutor said.

There was also the worry about getting arrested. Paz had been a cop for 20 years, a vice detective for part of that time. He is alleged to have applied everything he learned about catching criminals to avoid being caught when he became one.

And, as the prosecutor told it, the years of working vice with undercovers had not kept him from relaying real-time intelligence from Samaniego to the underlings in the particular brothel.

The prosecutor gave a sample of what Paz had been recorded relaying when an undercover (UC) was approaching a location.

“The UC is coming up the block… The UC is Asian with a beard.”

The prosecutor charged, “He set up law enforcement personnel who are extremely vulnerable… When you tell people there’s an undercover coming into a brothel, who knows what’s in the brothel?”

The prosecutor noted that Paz is also from Ecuador, suggesting he might flee. His lawyer, Frank Kelly, noted that his client served in the Army Reserves. Kelly also actually suggested that his client is “more a victim of police retaliation,” supposedly targeted by cops who are unhappy with him for not cooperating with them in running their prostitution and gambling organization.

“ That translates to 50,000 tricks at $40, more if you count the discounted sex for bad cops. ”

The judge set bail at $325,000 cash, and Paz was led into the holding cell. His lawyer briefly conferred with him and returned to the courtroom saying his client had declined something offered to ex-cops who are incarcerated.

“He doesn’t want protective custody,” Kelly reported.

From his time in vice, Paz had learned undercovers were forbidden to expose their private parts. This had led to a simple procedure that had allegedly been among the duties of Jessica Ortega, a defendant who followed Paz before the judge. She had been charged with screening arriving clients.

“Including clients’ reproductive genitalia,” the prosecutor said.

The accused genitalia inspector was freed without bail. She left the courthouse in a blue Gap hoodie, returning to a booming New York that good and courageous cops have transformed from Fear City into the safest big city in America, sacrificing their lives in the effort.

One positive note in this case is that the investigation was initiated by a tip from a good cop. IAB worked it for 13 months and determined there were cops who repeatedly risked ruining their lives for a $20 discount at a whorehouse.

IAB also gathered hundreds of recordings and videos and observations establishing that an active-duty cop knowingly and deliberately placed undercovers in danger even as he was working with them, even as he spoke to them on the phone.

And to make it worse, he was allegedly in the pay of a retired vice cop running an organization whose prostitution enterprise alone is estimated to have earned $2 million in the course of the investigation.

That translates to 50,000 tricks at $40, more if you count the discounted sex for bad cops.