He did this while the army of the king of Babylon was attacking Jerusalem and the cities of Lachish and Azekah. He was attacking these cities because they were the only fortified cities of Judah which were still holding out. 