Gedaliah, along with the prophet Jeremiah, advised the Jews to accept the yoke of Babylonian rule and to work towards restoring the country. However, certain zealots arose who opposed Gedaliah's subservience to Nebuchadnezzar -- and they murdered him.
After Gedaliah's murder, the Jews feared reprisal from the King and thought to flee to Egypt to save themselves. They turned to the prophet Jeremiah to ask for counsel.
Jeremiah sought the LORD and then warned them that should they flee to Egypt, the sword from which they were running would slay them there. Unfortunately, the people did not listen and they fled to Egypt anyway. Worse still, they abducted Jeremiah and took him with them! Thus, the occupation of the land that began with an exodus from Egypt ended with a self-imposed exile to Egypt!