Scientists have identified a brain region that helps tell an animal when to attack an intruder and when to accept it into its home.