I once pulled out a S&W .22 revolver on 8 guys who wanted my camera equipment. Apparently, there weren’t 6 volunteers in the 8 to find out how good a shot I was, which was good for them - I had fired 10,000+ rounds thru it and the first 6 would have died.
Small, very easy to shoot accurately, very reliable and very cheap to practice with.
I was in a similar situation many years ago. As a group, they knew they could take me. As individuals, they knew I would kill the first one to make a move towards me. Nobody wanted to be that first guy.
Any firearm has the power to make somebody decide he'd rather not get shot today, and a .22 in the hand beats a .44 magnum left home in the safe. That said, a .22 has killing power, but its stopping power is mainly psychological unless you hit the brain stem. A drugged up or drunk assaulter may get shot, and then proceed to kill you before he goes down.