By law you can’t kill anyone
Though, some parts of law allows us to excert physical force to protect ourselves in an event of assault.
The amount of force should be proportional to the attacker and the motive of retaliation should be to avoid more harm.
It should never be an act of revenge.
Morally, society can treat a molestation on kids, women and men differently. So killing someone in case of kids or women sound morally just, but by law it’s not.