Jeremiah 32:3

For Zedekiah king of Judah had shut him up, saying, Wherefore dost thou prophesy, and say, Thus saith the LORD, Behold, I will give this city into the hand of the king of Babylon, and he shall take it;

Jeremiah's imprisonment took place during the third and final siege of Jerusalem by the Chaldeans, in the closing years of Judah's apostasy when hope had fled from every heart. The city was facing utter ruin, and the prophet had openly predicted its fall and insisted upon surrender. His message was that God Himself would deliver Jerusalem into the hand of the king of Babylon.

It was for that unwelcome prophecy that Zedekiah, king of Judah, had him shut up in prison. There he was held under close surveillance by those who scorned his messages. Yet even in confinement God did not abandon the faithful remnant still in the city to hopeless despair. He gave Jeremiah fresh revelations of heaven's willingness to forgive and to save, revelations that remain an unfailing source of comfort to the church.