Therefore thus says the Lord: Behold, I will bring upon them evils from which they will not be able to go out; and they will cry to me and I will not hear them. And the cities of Judah and the inhabitants of Jerusalem will go and cry to the gods to whom they pour libations; and these will not save them in the time of their affliction. God does not hear in the time of need and distress, because they too would not hear the voice of the Lord. This Saul also suffered; for when, dreading the ranks of the Philistines, he had not deserved to receive the word of the Lord, he turned to the pythoness, s...o as to learn from idols what he ought to have wrung from the Lord by the insistence of prayer and of tears. Through these things we learn that, even if the Lord does not hear, we must by no means cease, nor flee for refuge to demons. They cannot help their worshipers; but we must flee to the help of the Lord, who, though angered, is quickly turned and changes his sentence, if those too with whom he has been angry are changed. And all that is now said pertains to the tribe of Judah and the city of Jerusalem, upon whom captivity is pressing.
Source: Commentary on Jeremiah