This article was originally published on Huffington Post by David Moye.

Police in Michigan will no longer be allowed to have sexual relations with sex workers during prostitution investigations, if a new bill is signed into law.

The bill — SB 275 — passed unanimously in the Michigan State Senate on Wednesday. It takes away immunity that previously made it legal for cops to have sex with sex workers if it happened during an investigation, MLive reports.

Michigan is the last state to allow a free pass to undercover officers under these circumstances. The exemption was intended to protect officers working on sting investigations of prostitution rings, according to the Detroit Free Press.

However, officer immunity can have disastrous consequences, according to Mary Katherine Burke, an international human rights lawyer and advocate for victims of human trafficking.

Burke told the Independent that law enforcement officers have been known to abuse their power to coerce victims into sex acts.

“I’ve heard of stories of adult sex workers being detained by law enforcement and having them offer to release the sex worker without arresting or charging if the sex worker performs some sort of act… and then arresting the sex worker on prostitution charges anyway,” she said.

Bill sponsor State Senator Judy Emmons doesn’t think Michigan police officers are taking advantage of the immunity, but said it’s better not to take any chances.

“I don’t think it’s probably a problem,” she told the Free Press. “From what law enforcement tells me, nobody is trained in this, but it’s still on your books and it looks bad. And there could be a rogue [cop] who might take advantage of it, so let’s just get rid of it.”

Michigan is the last state of the union to allow this exemption after Hawaii passed a similar ban in 2014. At the time, Honolulu police claimed they needed the legal protection because otherwise prostitutes would insist on sex to identify undercover officers. Law enforcement experts disagreed, saying the agreement to exchange money for sex is sufficient evidence of a crime.

Although the bill passed unanimously in the Michigan Senate, it will need to pass the House of Representatives and be signed by Gov. Rick Snyder to become law.