My personal favorite defense gun has always been a Beretta Jetfire in 22 short. I have carried it for many years including while hiking. I never leave home without it.
Of course the first rule when hiking in the wilderness is to use the "Buddy System". This means you NEVER hike alone, you bring a friend, companion or even an in-law because if something happens there is someone to go get help.
I remember one time while hiking with my brother-in-law in northern Alberta and out of nowhere came this huge brown bear charging us and boy, was she mad. We must have been near one of her cubs.
Anyway, if I had not had my little Jetfire I would not be here today. Just one shot to my brother-in-law's knee cap and I was able to escape by just walking away at a brisk pace.
That's one of the best pistols in my collection..