NEW YORK CITY — A Brooklyn City Councilman is looking to make it illegal for police officers to have sex with people in their custody in the wake of an investigation into two Coney Island detectives accused of raping a teenager.

Councilman Mark Treyger, who represents Coney Island, said he would draft legislation that would close the existing loophole in the law — which bans correctional and parole officers from having sex with detainees or parolees on the job, but does not prevent on-duty police officers from having sex with people they encounter in the course of their work.

Treyger has joined a chorus of other advocates and critics in arguing that the power differential between police and civilians should make sex between them automatically nonconsensual, an issue that has come to the fore after the detectives accused of the Coney Island rape claimed to have had consensual sex with the teen.

“Necessarily, the power dynamics between a trusted agent of our criminal justice system and an individual under supervision mean that no sexual consent can be given entirely free from coercion,” Treyger wrote in a statement posted online. “We do not need a change in laws, however, to understand that what occurred was deeply, morally wrong.”

The push for legislation comes as the Brooklyn District Attorney’s office investigates detectives Richard Martins and Eddie Hall, who are accused of handcuffing an 18-year-old during a traffic stop, forcing her to perform oral sex and raping her in an unmarked van.

Both detectives, along with their supervisor, 22-year NYPD veteran Sgt. John Espey, have been stripped of their guns and badges and placed on desk duty pending the outcome of the investigation. According to the woman’s lawyer, the pair picked up the young woman during a traffic stop in Calvert Vaux Park in Gravesend and drove her to a nearby Chipotle parking lot, where they told her she could have sex with them or go to the precinct.

The lawyer, Mark David, said both detectives forced her to perform oral sex on them and one of them raped her, all while she was handcuffed. But the officers have claimed it was consensual, sources said.

Treyger said the incident should be considered a crime no matter what, lamenting the effect it could have on relations between police and the community.

“The abuse of power exercised by these two detectives rattles the foundations of positive police-community relations that the law enforcement community has been working to build,” he wrote.

Treyger urged his fellow lawmakers in the state Senate and state Assembly to address the matter with new legislation as well.

At an unrelated press conference Tuesday, Mayor Bill de Blasio declined to comment on the specifics of the case but said he did not understand how someone in police custody could consent to sex.

"I don’t see how that’s possible, honestly,” he said. “Any instance like this needs a full investigation so I’m not going to comment on the specific situation under investigation, but as a broad notion, I find it very troubling.”

The case has prompted at least one protest, and the detective’s attorneys were met with a wave of outrage after a letter was leaked to the New York Post in which they called into question the woman's credibility based on her online presence.

“This behavior is unprecedented for a depressed victim of a vicious rape,” the lawyers wrote, according to the Post.

A spokesman for the Brooklyn DA’s office declined to comment about the case, but lambasted the lawyers for the letter.

“Without commenting on this ongoing investigation, defense counsel’s characterization of how a rape victim should behave is inaccurate, inappropriate and demeaning,” spokesman Oren Yaniv said.

Mark Bederow, the attorney representing Martins, declined to comment about specifics, but cautioned against a rush to judgment.

“Rather than assume the accuracy of very specific and unchallenged allegations repeatedly disseminated to the media by a plaintiff’s attorney, I strongly urge people to withhold judgment until all of the evidence is carefully scrutinized,” he wrote in an email.

Hall's attorney, John Arlia, declined to comment.

A police spokesman did not immediately respond to a request for comment.