A loophole in Rhode Island law that effectively decriminalized indoor prostitution in 2003 also led to significant decreases in rape and gonorrhea in the state, according to a new analysis published by the National Bureau of Economic Research.

“The results suggest that decriminalization could have potentially large social benefits for the population at large – not just sex market participants,” wrote economists Scott Cunningham of Baylor University and Manisha Shah of the University of California, Los Angeles, in a working paper issued this month.

Mr. Cunningham and Ms. Shah got an opportunity to study the effects of decriminalized prostitution on crime and public health because Rhode Island lawmakers made a mistake. A 1980 change to state law dealing with street solicitation also deleted the ban on prostitution itself, in effect making the act legal if it took place indoors. The loophole apparently went unnoticed until a 2003 court decision, and remained open until indoor prostitution was banned again in 2009.