Virginia state Sen. John Cosgrove (R-Chesapeake) takes part in proceedings on the floor of the Virginia Senate in Richmond. (Steve Helber/Associated Press)

THE VIRGINIA Senate has passed legislation that would transform all law enforcement agencies in the commonwealth into secret police, quite literally, a dangerous step in the direction of unaccountable and non-transparent government. No other state has gone as far as the Senate bill would take Virginia into the realm of secrecy where it concerns state and local police.

The legislation, sponsored by Sen. John Cosgrove (R-Chesapeake), would shield the identities of all local and state law enforcement officers, as well as their employment dates, positions and training, from Virginia’s Freedom of Information Act.

Mr. Cosgrove’s rationale is that police and sheriff’s deputies are in peril as never before, the danger arising from revelations and allegations of police brutality and unwarranted killings across the country. “Unfortunately, our culture has changed,” he says. “Many times, police officers are considered fair game.”

This is demonstrably false, a canard to facilitate government’s natural impulse to operate in secrecy. It would do little or nothing to enhance officer safety, but it would do much to shield corrupt, arrogant and corner-cutting officers and agencies from the cleansing glare of public scrutiny.

Police officers do have dangerous jobs; no one disputes that. However, the evidence shows that the danger they face has declined steadily and substantially for many years.

As The Post’s Radley Balko and Mark J. Perry of the American Enterprise Institute have documented meticulously, 2015 was one of the safest years for U.S. police officers on record, surpassed only by 2013. Gun-related deaths of police officers have fallen to a fraction of their level in the 1970s, to say nothing of the carnage during Prohibition. While viral videos of police abuse and unwarranted killings may have contributed to more threats against police, there is no evidence that anyone accused in an officer-involved shooting was subsequently harmed as a result of the publication of his or her name.

The real effect of hiding the identities of officers would be to shield them and their agencies from accountability. The Virginia legislation was offered not in response to any act of violence, but to a judge’s ruling directing the state to hand over the names and employment dates of law enforcement officials sought by the Virginian-Pilot. The newspaper, based in Norfolk, had undertaken to show how officers with blemished records hop from one law enforcement agency to another.

We can think of plenty of other instances involving nepotism, falsification of records, doctored disability claims and other scams that have beset law enforcement organizations from time to time, which agencies and police unions, duly embarrassed, would have loved to cover up. Thanks to open-records laws, keeping such abuse secret has been difficult. Virginia would be ill-advised to make it easier by enacting Mr. Cosgrove’s legislation.