I've found that plain water with a dose of sudsy ammonia added is a strong deterrent. Most animals hate ammonia and the small amount of detergent allows the mix to soak into fur instead off just rolling off. And they can't stand to lick themselves clean with the mix in their fur.

Second, if you have time, a little space and the presence of mind you might try throwing things at the dog/s. Dogs get quite alarmed when they get by even small stones. For some reason they can't easily connect the pain of the stone to your throwing it. Hit a dog with a stick and they often fight you. Hit it with even a small rock and they often look like they are very confused. Like they can't connect the sting to any source.

I have been told that pets are legally just property. You have a right to protect yourself from harm that may come from runaway property. Kill a dog in self defense and as I understand it your usually on sound legal ground as long as you had a reasonable reason to fear bodily harm.

But after the fact, because the animal is property, the law is much more restrained about having the animal put down.

It is something like if your neighbors car was left on a hill and it started rolling toward a playground full of kids. You have every right, possibly a moral duty to do whatever you can to prevent potential bodily harm. So if you drive you trusty bulldozer into its path your justified even if the car is destroyed. On the other hand if the car wasn't stopped, even if it ran over a kid or two, the state wouldn't demand that car be destroyed. Destroying the car after the fact won't undo the damage.

Usually there has to be a clear pattern of violence from the dog and usually some remedial attempted taken before the courts deprive someone of their property.