God is superintending or managing events on this earth. When He wants something done through a man, He interfaces with him. Perhaps without the person even being aware of it, God can insert thoughts into the person's mind to do what He wants him to do.
The event related here is Jeremiah's Seventy Years Prophecy. This verse does not tell us what political, military, social, or economic events God may have manipulated to get Cyrus to consider and finally to choose to issue this edict. It would be beyond belief to think that Cyrus thought of it on his own, out of the blue. Nations act in their national interest. Somehow, Cyrus concluded that it was in the national interest of Medo-Persia to relocate a small portion of the Jews, and he also gave them the opportunity to restore the Temple in Jerusalem. This particular occasion was not unique: Cyrus did this for other peoples that the Medo-Persians had conquered, perhaps to curry the favor of their gods or as a carrot to dissuade them from rebelling.
However it occurred, God inspired it without removing Cyrus' free moral agency. Some modern translations translate the phrase "stirred up the spirit of Cyrus" as "God moved Cyrus' heart."
John W. Ritenbaugh
The Holy Spirit and the Trinity (Part 3)
Other Forerunner Commentary entries containing Ezra 1:2: