The law of unintended consequences spares no one, not even people in law enforcement.

Until a few years ago, the only things preventing the random passerby from walking or driving into the parking lots behind Los Angeles Police Department stations were signs that read, “Police personnel only beyond this point.”  For people involved in security, our facilities weren’t very secure.

Slowly but surely, security gates were installed at all of the 21 stations scattered across the city’s 469 square miles, and now officers and other employees presenting themselves at the entrance to a police parking lot must swipe their ID cards or enter a code on a keypad to gain admittance. Until the other day, no one gave this arrangement much thought.

And then someone tried to kill two detectives who were driving into a station parking lot, and suddenly people were saying, “Well, we made it easy for him, didn’t we?”

Here’s how it unfolded: At about 4:30 a.m. last Tuesday, two detectives arrived at the LAPD’s Wilshire Division station, near the intersection of Venice Blvd. and La Brea Ave., in the Mid-City area. As they sat in their car waiting for the security gate to open, a lone gunman ran up and fired several rounds into the car. Fortunately, the man’s marksmanship was poor; neither detective was seriously injured.

But the incident left many of us in the LAPD wondering when it might happen again.

The Christopher Dorner case understandably put police officers on edge all over Southern California. Here was a guy, a former cop himself, who had already killed and promised to kill again. In looking back on it, it’s a wonder he didn’t take advantage of the vulnerability displayed last week. Consider: Dorner was equipped with all manner of weaponry, including a sniper rifle. At virtually every police station in the city, and at the LAPD’s headquarters building downtown, he had the opportunity to sight in his rifle on the exact spot where every cop who wanted to drive into the lot would be sitting as he swiped his ID card or punched in the code. Seated in a car, back to the aggressor, most likely with a seat belt on making it difficult to draw a weapon — one couldn’t ask for a more convenient target.

Which must have been the thought of the man who shot at the two detectives last week, the man who, as of this writing, has been neither arrested nor identified. And he just might be weighing when and where to try again.

Whenever I write a column here that touches, however tangentially, on the dangers of police work, there inevitably appears in the comments some rebuttal pointing out that other occupations, like commercial fishing, farming, and roofing, are more hazardous. Which is true, as far as the raw numbers go, but statistics don’t tell the whole story. In all those other trades, most of the injuries and deaths occur when people fail to observe customary precautions. But in police work, when you adjust the numbers to distinguish cops working the street from their counterparts in administrative jobs, my guess is that police work — real police work — truly is among the most dangerous occupations. Furthermore, it’s one in which you can take every precaution conceivably allowed to you and still get injured or killed. No one kills a fisherman just for being a fisherman.