Delta_6 I would advise you to train with a gun if you want to be able to defend yourself from armed gangs as you point out. I would say the same thing that other posters have said on this thread, get good training before you carry a gun otherwise having a gun will do more harm than good, not the least being that you might injure/kill and innocent person. Also you should obviously look into the legality of owning and carrying guns where you live.
Aside from that you say the gangs only come out at night. A good idea might be to simply not go out at night.