In Joshua 20 God instructs Joshua to set six "cities of refuge" throughout the newly acquired Promised Land. These cities were intended to provide protection for those who found themselves in the unfortunate position of having accidentally injured or killed another human being. In such an event, a person would flee to a nearby city of refuge for protection from the victim's family seeking vengeance for the spilled blood of their family member until the case could be heard and a judgment could be rendered.
God instituted the cities of refuge to preserve human life - innocent life. If an accidental death occurred at the hands of another, the cities of refuge guarded against a further injustice of the taking of the life of the "manslayer." Clearly, the institution of the cities of refuge shows us that God desires to preserve human life as much as possible. God loves human life because it is made in his image and it is to be held in high regard and protected to the best of our ability (Genesis 9.5-6).
However, the notion that God loves human life and desires to protect it as much as possible can ring hollow when derived from a book of scripture like Joshua - arguably the most violent and blood-stained book in the entire Bible. Indeed, the book records the divinely-sanctioned death of countless thousands of Israel's enemies (see, for example, Joshua 6.21, 8.25-26, 10.26, 11.6, etc.). If the institution of the cities of refuge show us that God loves and desires to protect human life - as indeed it does - then why does God seem to condone so much killing? A further understanding of the cities of refuge can help us to answer this question.
If a man were to accidentally - and without negligence - harm or kill another human being, to take his life as punishment would be a miscarriage of justice. Not only does God love human life, but he also loves justice, and so to repay one tragedy with another would be unjust. However, in the event that a murder is committed with malice aforethought, or if innocent life is lost as the result of gross negligence, a just punishment is justified (see Numbers 35.16-21 and Exodus 21.28-29 for examples).
These principles should help us think about the other descriptions of God-sanctioned killing in scripture. God does not desire to kill, nor have his people kill on his behalf. God created man in his own image - male and female he created them - and as image bearers they are the crown jewel of God's creation. All human lives have value; all human lives are precious. It is not his desire for any of them to be destroyed (2 Peter 3.9). In fact, because man is made in his image, there will one day be a reckoning for every drop of human blood that has ever been spilt (Genesis 9.5-6).
In every instance in the Bible, God desires to preserve and protect human life as much as possible - even the lives of the most despicable and wicked people who have lived throughout history. The Canaanites, whom God commanded the Israelites to kill and/or drive out of the Promised Land, were vile, wicked people. Their religious practices often called for human - and even child - sacrifices. They were idolatrous and hedonistic, refusing to acknowledge God. But even so, God did not desire to destroy them. In fact, he desired to preserve and protect them and bring them into his family. For this reason, God gave them a period of 400 years to turn from their wickedness and to him (Genesis 15.13-16). After that 400 year period, the choice of the Canaanites was evident: they had chosen to reject God and to refuse to acknowledge him as God. And thus their self-imposed destruction became imminent. The Canaanites were not innocent people who found themselves at the wrong end of an unfortunate tragedy. Instead, they were people who rejected every attempt by a loving God to bring about their salvation, and so they met their deserved end. God wanted to save the Canaanites, but the sad truth is that the Canaanites didn't want to be saved.
So we can say that not only does God desire to protect and preserve innocent human life as much as possible, but that he also desires to protect and preserve guilty, vile, and wicked human life as much as possible. It is not God's desire to kill his enemies; it is his desire to save his enemies.
Nowhere is reality this more evident than the cross. All people have turned aside and become corrupt. There are none who seek understanding, none who seek God. We have become worthless. There is no one who is good; not even one. Our feet are swift to shed blood, and in our paths are ruin and misery. The way of peace we have not known (Romans 3.10-11, 15-17). This is the human condition: a people who have rejected God and deserve his judgment - who deserve to be killed. But the cross shows us the lengths to which God is willing to go in order to not kill his enemies, but to save them. God was willing to sacrifice his own Son - to send him to earth to bear the punishment for the sins of all who would believe on the cross - so that anyone who would turn from their sin and trust in him might not receive the punishment that their sin deserves (death), but would instead receive life.
God loves life. He desires to protect, and preserve, and save, and give life as much as possible - even to his enemies! And he has given all people the opportunity to trust in him and receive life instead of death. He has provided a "city of refuge" in his Son, Jesus Christ. It is God's desire that his enemies will find this city of refuge in his Son and thereby find salvation from the punishment that they deserve.