From 2 Chronicles 35 (NIV):
20 After all this, when Josiah had set the temple in order, Necho king of Egypt went up to fight at Carchemish on the Euphrates, and Josiah marched out to meet him in battle. 21 But Necho sent messengers to him, saying, “What quarrel is there, king of Judah, between you and me? It is not you I am attacking at this time, but the house with which I am at war. God has told me to hurry; so stop opposing God, who is with me, or he will destroy you.”
22 Josiah, however, would not turn away from him, but disguised himself to engage him in battle. He would not listen to what Necho had said at God’s command but went to fight him on the plain of Megiddo.
Necho said that God had told him go go up, that God was with him, and that "God has told me to hurry". The text also said that "[Josiah] would not listen to what Necho had said at God's command..." Wikipedia identifies him as Necho II but is a little sketchy on certain biographical details. What were his religious beliefs, and why was he acting on God's commands? Would he actually have held to the religion of Judah, or would his beliefs have been more like Akhenathen's henotheism? And why is he called "king of Egypt" rather than Pharaoh? Wikipedia identifies him as Necho II, but doesn't really address his religious beliefs.