"Son of man, set your face against Jerusalem and preach against the sanctuary. Prophesy against the land of Israel and say to her: 'This is what the LORD says: I am against you. I will draw my sword from its scabbard and cut off from you both the righteous and the wicked. Because I am going to cut off the righteous and the wicked, my sword will be unsheathed against everyone from south to north."
Ezekiel prophesied during the siege of Jerusalem and exile and captivity of the Jews (Ezek 1:2-3). The destruction of the city of Jerusalem was in punishment for its sins. The righteous people were not killed, but were exiled (Jer 24:5-7). Thus they were cut off from Jerusalem, but without experiencing the violent death of the wicked. Had any of the righteous people remained in Jerusalem, they would have heard Jeremiah's prophecy that those who surrendered themselves to the Babylonians would survive (Jer 21:8-9).