The word that came to Jeremiah from the Lord after Nebuzaradan the captain of the guard had let him go from Ramah, when he took him bound in fetters along with all the captives of Jerusalem and Judah who were being exiled to Babylon.
The captain of the guard took Jeremiah and said to him, "The Lord your God threatened this place with this disaster;
and now the Lord has brought it about, and has done as he said, because all of you sinned against the Lord and did not obey his voice. Therefore this thing has come upon you.
Now look, I have just released you today from the fetters on your hands. If you wish to come with me to Babylon, come, and I will take good care of you; but if you do not wish to come with me to Babylon, you need not come. See, the whole land is before you; go wherever you think it good and right to go.
If you remain, then return to Gedaliah son of Ahikam son of Shaphan, whom the king of Babylon appointed governor of the towns of Judah, and stay with him among the people; or go wherever you think it right to go." So the captain of the guard gave him an allowance of food and a present, and let him go.
References for Jeremiah 40:5
Then Jeremiah went to Gedaliah son of Ahikam at Mizpah, and stayed with him among the people who were left in the land.
When all the leaders of the forces in the open country and their troops heard that the king of Babylon had appointed Gedaliah son of Ahikam governor in the land, and had committed to him men, women, and children, those of the poorest of the land who had not been taken into exile to Babylon,