As the Lord spoke a prophecy against Babylon, He said of Cyrus of Persia,
“All of you, assemble yourselves, and hear! Who among them has declared these things? The LORD loves him; he shall do His pleasure on Babylon, and his arm shall be against the Chaldeans. I, even I, have spoken; Yes, I have called him, I have brought him, and his way will prosper” (Isaiah 48:14-15).
Even as the Lord used Babylon against Judah to punish them for their sins, so the Lord would use Persia against Babylon to punish them for their sins.
While Cyrus may have thought he was doing his own will, yet, in truth, the Lord operated behind the scenes and prospered Cyrus and Persia because Babylon had become exceedingly arrogant.
Therefore, God prospered Cyrus, and God will prosper those who preach righteousness and against wickedness.