In Isaiah, God uses the wicked nation of Assyria to bring punishment to Israel.
Isa 7:17 The LORD will bring the king of Assyria upon you and your people and your father’s house—days that have not come since the day that Ephraim departed from Judah.”
Isa 7:18 And it shall come to pass in that day That the LORD will whistle for the fly That is in the farthest part of the rivers of Egypt, And for the bee that is in the land of Assyria.
Isa 7:19 They will come, and all of them will rest In the desolate valleys and in the clefts of the rocks, And on all thorns and in all pastures.
The text explains God’s methodology. God “whistles”, an obvious metaphor for God enticing the Assyrians and the Egyptians to come. The illustration is that a beacon is sent out and all the predatory and annoying creatures flock to the beacon. God lures the enemies of Israel against Israel. In chapter 5, God explains His motivation: because Israel had done evil and abandoned God:
Isa 5:4 What more could have been done to My vineyard That I have not done in it? Why then, when I expected it to bring forth good grapes, Did it bring forth wild grapes?
Isa 5:5 And now, please let Me tell you what I will do to My vineyard: I will take away its hedge, and it shall be burned; And break down its wall, and it shall be trampled down.
God later states that He will punish the Assyrians for the very act that He enticed them to take:
Isa 10:12 Therefore it shall come to pass, when the Lord has performed all His work on Mount Zion and on Jerusalem, that He will say, “I will punish the fruit of the arrogant heart of the king of Assyria, and the glory of his haughty looks.”
Isa 10:13 For he says: “By the strength of my hand I have done it, And by my wisdom, for I am prudent; Also I have removed the boundaries of the people, And have robbed their treasuries; So I have put down the inhabitants like a valiant man.
So God wants to punish Israel and lures Israel’s enemies into the land. God then punishes Israel’s enemies for their behavior that God enticed them to take. The question is often asked: How is God just for punishing someone for taking actions God wanted them to take?
Hypothetically: A husband has a wife who always leaves the car doors unlocked in the driveway. The wife also leaves cash inside her car. The husband wants to teach his wife a lesson, so advertises on social media that this is her standard practice. He knows that shady characters might read his posts and decide to break into the car. The husband waits for a thief to arrive and then calls the cops when it does happen. The cops arrest the thief and the husband presses charges. Is the man unjust for punishing the criminal?
I believe most people would say that the husband is justified in punishing the criminal, even if the husband’s intent was to use the evil person’s actions for his own purposes. This happens all the time, not only in criminal matters but in war. Using your enemy’s resources to your own ends is master manipulation, not endorsement of them as moral creatures. Manipulating them to act does not absolve them of personal guilt. In this way, God can accomplish His goals through the evil actions of others and still hold them morally accountable for those actions.