Bullying is a factor in many, if not all, incidents of school violence. If I hear of a shooting in a school, I can immediately describe the shooter because they are predominately white males, have access to guns, and they feel unconnected, left out, shut out.
Prejudice against certain groups can come from the home. They learn by hearing their parents. If parents make fun or are mean to those who are different, that is how children learn their parent's value system.