HARFORD COUNTY, MARYLAND — Sheriff's deputies Terry Lindsey and Diana Ciaramellano are walking into a backyard in a residential neighborhood, responding to a tripped burglar alarm, when a mid-sized dog runs out to see who has traipsed onto its masters' property. The dog barks and growls at the deputies from about 15 feet away, every bit of its body language conveying a clear message: LEAVE.

Deputy Lindsey yells at the dog to go away while unclipping the pepper spray from his belt with his left hand. To his right, Ciaramellano unholsters her gun, in case Lindsey's pepper spray doesn't work. She could reach for her taser, but a dog is a small, fast-moving target from straight ahead, and the prongs the weapon fires are finicky.

The dog ignores the commands and stands its ground. What happens next in this kind of situation could be either another routine day for the Harford County Sheriff's Department or end up as a major lawsuit, complete with local, maybe even national, headlines: "Maryland Cops Kill Family Dog in Backyard."

The dog charges forward, and Lindsey fires the pepper spray. It works. The animal yelps and retreats. The encounter probably takes fewer than 10 seconds.

The large projector screens surrounding the deputies go blank. They are standing in a big, dark room on the second floor of the Harford County Sheriff's Department in front of a VirTra use-of-force simulator—a high-tech video tool that trains deputies how to respond to real-life situations in real time. The guns, tasers, and spray canisters are all modified with lasers that the projector screens detect and react to.

The simulator can hold hundreds of different live-action video scenarios, from active shooters to domestic violence calls to traffic stops—each one with several branching options that an operator at a computer can choose from, depending on how the officer responds—but these Harford County deputies are among the first in the country to use it to learn how to deal with dogs.

The initiative is the brainchild of the National Sheriffs' Association (NSA), a nonprofit group that represents sheriffs across the country, and it's part of an increasing recognition by law enforcement that it has a problem with dogs. Reason travelled to the Harford County Sheriff's Department for a demonstration of how officers are being trained to fix it.

Over the past decade, countless stories of police shootings of dogs have sparked public outrage and led to huge lawsuits against departments. But NSA deputy executive director John Thompson says police officers typically receive little to no training on how to deal with dogs, beyond using lethal force, despite the near-guarantee that they will encounter one at some point in the course of their duties.

"I'm a perfect example," Thompson, now retired from law enforcement, says. "I would have just shot a dog if he came at me biting and barking and snapping. It's just what we did. It was taught to us. You neutralize the problem. It was an acceptable practice in the older days and still seems to be across the country in many agencies."

The NSA says additional pilot programs are being planned in Orange County, Florida, and Oakland County, Michigan. The group is also working with the Justice Department's Community Oriented Policing Services (COPS) program to develop a comprehensive course for police to learn how to handle and deescalate canine encounters.

"We identified that this was a problem and created this training so we could keep officers safe, pets safe, agencies from paying out multi-million dollar lawsuits, and honestly, so we can keep the relationship between police and community a whole lot better, because it's just rampant," Thompson continues. "Every day you hear of an officer shooting a dog. It's not because they're crazy, warmongering people who want to shoot a dog, it's just they've never been trained or told different."

The results of that lack of training can be devastating for families — and very, very expensive for cities. Detroit, for example, paid out $225,000 earlier this year to settle a lawsuit by a couple alleging police officers shot their dogs from behind an 8-foot-tall fence during a marijuana raid. Last year a jury awarded a Maryland family a whopping $1.26 million in a dog shooting lawsuit.

These lawsuits are a relatively recent development that stemmed from a 2005 ruling by the Ninth Circuit Court of Appeals. In that case, the federal appeals court declared that the unreasonable seizure (that is, killing) of a dog by police was a violation of the Fourth Amendment, and the city of San Jose was forced to pay out nearly $1 million to the families of two members of Hell's Angels whose dogs were shot by police during the execution of a search warrant.

Since then, the proliferation of video technology and social media has led to local stories of dog shootings going viral and ricocheting around the country. There's a whole category of stories on Reason's website called "puppycide." For example, there was the time last year that a Louisiana cop shot a 12-pound dog and then allegedly told the family it was a "shame" he "had to waste that bullet because it's a really expensive bullet." Or the NYPD officer who shot a woman's dog seconds after it slipped through the door and walked toward him wagging its tail. Or the Oklahoma cop who used a high-power rifle to shoot a dog through a fence during a five-year-old's birthday party. Or there was the time in 2012 that a SWAT team in St. Paul executed a wrong-door raid, shot the family dog, and then allegedly forced three handcuffed children to sit next to their dead pet.

Just how many dogs a year are shot by police is not known or tracked in any systematic way. A Justice Department official speculated in a 2012 interview with Police magazine that the number could be as high as 10,000 a year, calling it "an epidemic," but that figure is little more than a guess. A 2012 study by the National Canine Research Council estimated that half of all intentional police shootings involved dogs. Public records obtained by Reason showed Detroit police shot 54 dogs last year. Chicago police shot or shot at 700 dogs over the last decade, according to the Chicago Tribune.

Several states now mandate some form of dog training for police, following incidents and lawsuits like these. Colorado passed the Dog Protection Act in 2013. In Texas, the state legislature mandated dog training for police thanks to a three-year effort by Cindy Bolling, whose Border Collie mix was shot by a police officer in 2012. The Chicago Police Department says its seen a 67 percent drop in dog shootings over the past three years thanks to better training.

The federal Justice Department has also taken some steps to try to teach officers how to handle dogs. Dog trainer Brian Kilcommon produced a series of videos several years ago for the COPS program to train local and state officers on how to read dog behavior and respond to it appropriately. However, those videos were no replacement for hands-on training, nor were they mandatory.

"We have a lot of [departments] becoming proactive," Thompson says, "but unfortunately, and I hate to say it, it usually takes an incident for them to open their eyes and see it."

The Harford County Sheriff's Department would like to stay ahead of the curve. Department spokesperson Cristie Hopkins says it hasn't had a dog shooting incident, but all of its deputies are going through the program.

In another training scenario, Deputies Lindsey and Ciaramellano are put into a family living room to respond to a domestic disturbance. As a couple explains they were just having an argument, a dog bounds around the corner and starts barking. "Sir, can you put your dog away?" Lindsey and Ciaramellano repeatedly ask the man on the screen, warily keeping their hands near their utility belts, until the owner eventually complies.

The operator of the VirTra system can change the dog's behavior, and even the type of dog, from large and friendly to small and aggressive. Depending on what the deputies do, the operator can change the dog owners' reactions as well. For example, the couple in the above scenario will, quite understandably, get irate if one of the deputies draws their gun.

"If I pull out a firearm in your home, you're going to get upset," the VirTra operator, Corporal Greg Young, explains. The system, he says, is more of a tool for judgement training than a shooting gallery simulator.

The system is also loaded with videos demonstrating typical dog behavior and body language—for example, what a friendly, excited dog looks like running toward you, as opposed to an aggressive dog. In many of the more egregious examples of dog shootings, officers mistake or simply ignore the dog's behavioral cues before using lethal force.

The VirTra simulator is a big, expensive piece of equipment—$150,000 to $300,000, depending on the model—and not every agency will be able to afford one, or probably even have space for one. If there's any downside to the program, it might be in the funding models. The Harford County Sheriff's VirTra simulator, as sign outside the training room proudly states, was paid for entirely with asset forfeiture funds from drug cases, which, it must be noted, have their own set of civil liberties problems. And while training beat police how to deal with a dog may defuse many situations, a major issue is the rise in volatile SWAT raids, which put heavily armed police in direct confrontation with now-ubiquitous dogs. The use of SWAT teams has risen from around 3,000 deployments per year in 1980 to as high as 80,000 a year currently.

But shooting fewer dogs overall is a popular goal, and odds are the simulator is less costly in every sense than killing a family pet.

"Society is changing, and dogs have value now," Thompson says. "In the old days it wasn't the same. Now dogs are part of people's families. My dogs are my family, they're just like my kids. We as a law enforcement profession have to understand that change. Again, no officer should be put in a position to get hurt, and we're not saying it's never going to happen. There's going to be cases where you're going to have to shoot the dog—you just don't have a choice—but when you train and plan, the outcome is going to be better than if you go in with no training."