They were killed because the whites were nearing where they were kept.
Whilst there's always more to be said this answer by /u/facepoundr may help
it's an older answer and thus might not be up to todays standards.