Aztec sacrifices where practical consequences of their mythology, in which they believed that life and every thing was cyclic so they thought that with human sacrifices they where somehow counteracting the end of humankind by giving the gods some human blood, mostly from the best they had, in order to make humans live longer.
When analyzing good and bad, we must always consider that the<em> ideas we have determines our actions and the meaning of them</em>. <u><em>And in the moment a whole community accepts some ideas as true then they are </em></u><u><em>allowed as good </em></u><em>(but</em><em> not </em><em>necessarily good themselves)</em>. In this case, Aztecs did such a barbaric thing as killing their best people because they all (as a community) thought that that was helping humankind, thus something good.
But as human intelligence is imperfect as it goes step by step and goes try and failure understanding what is every thing in the world it can make mistakes (even when science and philosophy help us get to the right answers), so we can find that some communities agree in some ideas that are wrong and that therefore lead to bad actions, as we see with Aztecs sacrificing people. Then, the reason why communities do bad things (considered as good) is because they have a wrong conceptions that are taken as right and good, and therefore people make bad things.
As ideas sow actions, then the root ideas can make you understand actions. But we can't JUSTIFY their evil; for we cannot say that sacrifice is a good thing and what they did was good, because objectively it is not as it goes against the dignity of men and women. For that reason is that education is so important, because it eradicates wrong ideas that lead to bad actions. In this case history talks itself, as when people realized that killing is wrong and that the gods didn't want human blood, they stopped doing it, and even start condemning it from then on.