A Virginia bill that would keep the names of police officers secret from the media and public is drawing harsh criticism from open records advocates who argue that the names are an important tool in keep watch over whether police departments are hiring potential problem officers with taxpayer money.

Supporters of the bill say that handing over the lists of names would possibly put officers and deputies at risk in the field during a time of what they describe as growing contempt toward law enforcement.

"It used to be that there was a healthy respect for law enforcement," said Republican Sen. John Cosgrove, the bill's sponsor. "Now they've become targets of opportunity."

Cosgrove’s reason for the backing of the bill comes from a tabloid San Antonio newspaper that threatened to publish the names and addresses of all city police officers after an officer was killed, according to the Virginian-Pilot. However, the editor-in-chief of the paper had backed off the idea.

Opponents of the bill call it a gross overreaction to an unlikely scenario.

State Sen. Chap Petersen, D-Fairfax, opposes the bill. He said withholding the names of police officers would lead to corruption within agencies.

According to the Associated Press, the measure was introduced in response to a court ruling directing the state to turn over the names and employment dates of thousands of law enforcement officials to The Virginian-Pilot. The paper said it’s seeking to determine whether problem officers who leave a department land a job at another agency.

"You're getting paid by the public. You don't get to do that in secret," said Megan Rhyne, executive director of the Virginia Coalition for Open Government.

Though some states have introduced bills shielding some officers or detectives, Dan Bevarly, an interim director of the National Freedom of Information Coalition, told AP he’s unaware of another state with a law of this scope.

In New Jersey, a bill would allow officials to withhold the names of state police detectives. West Virginia lawmakers are considering legislation that shields officers’ and their families’ contact information from the public. And several other states have or are examining laws aimed at preventing the release of the names of officers involved in shootings.

The bill passed Virginia's GOP-controlled Senate by a 25-15 vote this month, and still needs to get through the House of Delegates, where Republicans also hold the majority. It's being backed by all of the major law enforcement associations, including the Virginia State Police Association and the Virginia Sheriffs' Association.

A spokesman for Gov. Terry McAuliffe would not say whether the governor would sign the measure. But the Democrat has sided with law enforcement over civil liberties advocates in the past, such as when he vetoed a bill last year that sought to limit how long officials can hold onto information collected from license plate readers.

The Associated Press contributed to this report.

Click for more from The Virginian-Pilot.