Typically, when this question arrises people are referring to the story of Sodom and Gomorrah:
In order to answer this question, one has to understand God’s Word is Law. Therefore, He’s the only one that can judge his Law. If God made law and no one was held accountable for it, it wouldn’t be much of a law.
In the cases of Sodom and Gomorrah, the wickedness in their hearts was so out of control that God had to pass judgement on them, or he wouldn’t be a righteous judge. Seeing his law deliberately broken and doing nothing about it would be wrong on God’s part.
It’s easy to read these judgement incorrectly and say, God killed, but to correctly interpret these judgments, it’s easier to think on them in terms of the court system of today.
Do we blame the judge for sentencing a man to death for murder? No. We say that man’s actions led to his death since he disobeyed the law of that state.
It’s the same with God. Since God’s Word is law, if we break those laws, it’s well within his right to pass judgment on those who broke it. A judge’s job, in any circumstance, is to pass judgement. They can impart mercy, or give the full sentence of the law; that’s their role, and their choice. Note: The full extent of God’s law on sin is death.
When it comes to God using others to kill, it’s the same scenario. Do we call the Jury, or the one who carries out the death sentence a murderer? No. They are being used as tools to pass righteous judgment for the one’s who broke the law.
Since God Law is final, he can righteously act as the judge, jury and executioner, or he can use a righteous person to act as the executioner, as he sometimes does in the bible.