In 597 B.C., Babylonians captured Jerusalem and replaced Jehoiachin with Zedekiah as king.
A few years before 597 B.C. the king of Judah rebelled against Babylon and refused to send tribute. In response, the king of Babylon sent troops to siege and destroy the city. Fortunately, the current king of Judah died during the siege, and his young son, Jehoiachin, ascended the throne. To save his people, Jehoiachin surrendered and Babylon took most of the royal family back with them, leaving Zedekiah as king.
Zedekiah swore an oath to the Babylonian king. At first, he kept his oath, but then he started listening to other people. He started rebelling against Babylon. This resulted in Babylon destroying Jerusalem.