The Lord spoke his word to Jeremiah when Nebuchadnezzar king of Babylon was fighting against Jerusalem and all the towns around it. Nebuchadnezzar had with him all his army and the armies of all the kingdoms and peoples he ruled.
This is what the Lord, the God of Israel, said: "Jeremiah, go to Zedekiah king of Judah and tell him: 'This is what the Lord says: I will soon hand the city of Jerusalem over to the king of Babylon, and he will burn it down!
You will not escape from the king of Babylon; you will surely be captured and handed over to him. You will see the king of Babylon with your own eyes, and he will talk to you face to face. And you will go to Babylon.
But, Zedekiah king of Judah, listen to the promise of the Lord. This is what the Lord says about you: You will not be killed with a sword.
You will die in a peaceful way. As people made funeral fires to honor your ancestors, the kings who ruled before you, so people will make a funeral fire to honor you. They will cry for you and sadly say, "Ah, master!" I myself make this promise to you, says the Lord.'"
So Jeremiah the prophet gave this message to Zedekiah in Jerusalem.
This was while the army of the king of Babylon was fighting against Jerusalem and the cities of Judah that had not yet been taken -- Lachish and Azekah. These were the only strong, walled cities left in the land of Judah.