Motive revealed for school shooting