Police in Kansas are now prohibited from engaging in consensual sex with people in their custody, after Gov. Jeff Colyer signed a bill into law this week.

Kansas was apparently one of 33 states that didn’t explicitly forbid sexual relations “during the course of a traffic stop, a custodial interrogation, an interview in connection with an investigation, or while the law enforcement officer has such person detained.”

The bill, sponsored by Kansas state Rep. Cindy Holscher, D-Olathe, was signed by Colyer, a Republican, along with several other law-enforcement measures, the Wichita Eagle reported.  

The bill sprung from a case in which a detective wrongfully accused a Kansas City man of double murder, for which the suspect later spent 23 years in prison. The detective reportedly forced multiple women to have sex with him, and threatened to arrest them or their family members if they didn’t comply, the newspaper reported.

Kansas law had already addressed “sexual relations between police and persons in jail, but it didn’t say anything about if they had been stopped on the streets or were in their custody,” Holscher said. “This helps the person who was detained in their neighborhood or stopped for a ticket, that type of thing.”

Several lawmakers were reportedly shocked that no law explicitly banned the act and lauded Holscher for bringing the matter to light.

Click here for more from the Wichita Eagle.

Bradford Betz is an editor for Fox News. Follow him on Twitter @bradford_betz.