“What good does it do you if you are in the right but you don’t have the power? What does it profit you if you are in the wrong, but you have the power? Power is right.”
The basis of all morality is not itself moral, but reflects the prevailing relationship of forces and power. If this changes, the morals change.
That is why history is naturally written by the victors, because whoever wins has the power, and whoever loses does not. Since the balance of power is constantly changing, who was a good or bad ruler is also constantly changing.