Why did God order the killing of people in the Old Testament?

This article has been translated into the following languages:

عربى Português