Pharaoh's army had come from Egypt, and when the Babylonians who were blockading Jerusalem heard this news, they retreated from Jerusalem.
The LORD spoke his word to the prophet Jeremiah. He said,
"This is what the LORD God of Israel says: Say this to the king of Judah, who sent you to get advice from me: 'Pharaoh's army has come out to help you. But it will go back to Egypt, its own land.
Then the Babylonians will return. They will attack the city, capture it, and burn it down.
"'This is what the LORD says: Don't deceive yourselves by thinking that the Babylonians will leave you. They will not leave you.
Even if you would defeat the entire Babylonian army so that they had only a few badly wounded men left in their tents, they would get up and burn down this city.'"
The Babylonian army had retreated from Jerusalem because Pharaoh's army was coming.
So Jeremiah wanted to leave Jerusalem and go to the territory of Benjamin to take possession of his property there among the people.
But when he came to Benjamin Gate, the captain of the guard there, whose name was Irijah, son of Shelemiah and grandson of Hananiah, arrested the prophet Jeremiah. He said, "You're deserting to the Babylonians!"
Jeremiah answered, "That's a lie! I'm not deserting to the Babylonians." But Irijah wouldn't listen to him. Irijah arrested Jeremiah and took him to the officials.
The officials were so angry with Jeremiah that they beat him and put him in prison in the scribe Jonathan's house, which had been turned into a prison.