Poetic justice

Narrative technique

Poetic justice, also called poetic irony, is a literary device with which ultimately virtue is rewarded and misdeeds are punished. In modern literature, it is often accompanied by an ironic twist of fate related to the character's own action, hence the name "poetic irony".

From Wikipedia, under CC BY-SA. More on occurri.