A profound moral reversal occurs when a self-righteous judge is exposed as the greatest offender of all. Jerusalem is forced to confront her own spiritual collapse while standing beside the very cities she once harshly condemned. The primary approach among commentators is that Jerusalem, having previously sat in judgment over Sodom and Samaria, eventually fell into sins so severe that she made those notoriously wicked cities appear righteous by comparison.
In the past, before her moral decline, Jerusalem judged her sister city, Samaria, declaring her deserving of destruction and exile [רש״י, רד״ק]. Historically, this took the form of the righteous kings of Judah rebuking the kings of Israel for their idol worship [רד״ק]. Some understand this judgment as a formal condemnation [רש״י, מצודת ציון, מלבי״ם], while others view it as a deep-seated expectation for their downfall [ביאור שטיינזלץ]. However, the scope of comparison eventually expands from a single sister to multiple sisters, pulling Sodom and the surrounding towns of Samaria into the picture [רד״ק].
Because Jerusalem ultimately committed abominations far worse than theirs [מצודת ציון], she is now commanded to carry a heavy, crushing burden of suffering [מצודת ציון, רד״ק]. She must endure the exact same harsh reality she once decreed upon them [מצודת דוד, ביאור שטיינזלץ]. This punishment operates on two distinct emotional levels: internal shame, which is a private feeling of embarrassment, and external disgrace, which is public humiliation inflicted by others [מלבי״ם].
Jerusalem's condition is compared to a judge who handed down severe sentences to minor offenders, only to be unmasked as a massive criminal himself. The judge's ultimate punishment is a triple humiliation: he must suffer the exact penalty he prescribed for others, he is forced to acquit the minor offenders because they are practically innocent compared to him, and he must watch as God redeems them before him. In this same way, Jerusalem suffers a crushing, threefold disgrace, forced to justify and vindicate the very cities she once convicted [מלבי״ם, ביאור שטיינזלץ, מצודת דוד].