When the Israelites say God did something, they often mean that God is overall sovereign, not that He directly did it. Like for example, if someone gets cancer from smoking cigarettes, they might say "God smote him with cancer", because God allowed cancer to happen to him, even though the actual cause is cigarettes. Arabs do this all the time when they say "Inshallah" - if God wills, or it is God's will.
We see an example of this just 2 chapters earlier when Israel goes to war with Philistine.
2 And the Philistines put themselves in array against Israel: and when they joined battle, Israel was smitten before the Philistines: and they slew of the army in the field about four thousand men. 3 And when the people were come into the camp, the elders of Israel said, "Wherefore hath the LORD smitten us to day before the Philistines? Let us fetch the ark of the covenant of the LORD out of Shiloh unto us, that, when it cometh among us, it may save us out of the hand of our enemies."
“Why has the LORD smote us today?“ they asked, meaning it was the Philistines who defeated them and God allowed it. The question would be rephrased in our English:" Why did God allow us to be defeated?" because to us to say: "why did God destroy us?" sounds inaccurate. This is poetic or idiomatic speech. We see this in similar examples like God sending evil spirits, God sending fiery serpents, God creates evil, etc when the meaning is permission. God would explain how this works in greater detail over the centuries https://characterofgod.org/i-create-evil/ (edited)
All power belongs to God, and when He PERMITS somemone to die, the Bible, especially in the Old Testament, speaks as if God did it directly, which is representative of their worldview and language. For more info, read this article: Are these actions of God to be literally understood? and Are so-called “plain statements” as plain as we think they are?