Considering that kill can bring bad karma, what must be done with some harmful animals like aedes aegypti, triatoma infestans, ticks etc., when it is on our way? And if they can be killed it means we can tranquilly kill a homo sapiens that is effectively more harmful than those creatures? (This question does not concern legal issues, just karmic e religious issues.)
My previous answer was entirely based on my own understanding and without any Scriptures to support it.
Now,here is a completely revised answer that is based on Scriptures:
When one's life is in danger, he can kill a Brahmana, Vysya, Kshatriya or a Shoodra or even a cow, horse or any other animal, to protect his life from them. This will not earn him any sin. ...The king, for the sake of the gods and the Brahmanas, should kill harmful animals such as the lion, tiger etc. In times of distress, the king may kill and eat an animal, that is fit to be consumed. He should never indulge in this act, in any other circumstance, except for the sake of gods and Brahmanas.
The above passage is from Brahmanda Purana,Uttara Khanda.
The words are those of Brihaspati(Deva Guru) and the conversation is between him and Deva Raja Indra.
According to Vishnu Smriti:
Protecting (one attacked by robbers, or by tigers, or otherwise in danger) is more meritorious than any (other) gift.
By doing so he obtains that place of abode (after death) which he desires himself.
188. He who kills (in his own defence a tiger or other) animal with sharp nails and claws, or a (goat or other) horned animal (excepting cows), or a (boar or other) animal with sharp teeth, or an assassin, or an elephant, or a horse, or any other (ferocious animal by whom he has been attacked), commits no crime.(Chapter V)
So,it seems,killing a potentially dangerous animal is not a sin provided you are being attacked by it.