Divine retribution (wrath) is the consequence of having incurred penance, divine disfavor, with a god.
Penance is increased by violating a god's conducts. All gods except Ru incur penance for abandoning them, e.g. Trog gives 50 penance on abandonment. It can be reduced by gaining piety and/or XP (see below for details).
Penance and retribution are usually synonymous; penance can cause retribution. The three good gods (Elyvilon, Zin, TSO) can incur "penance", but don't inflict punishments unless you worship a disliked god (all good gods hate evil gods; Zin also hates Xom and Jiyva).
Every time you gain XP with penance, a counter is decreased. When it reaches 0, there's a 5% chance (for each god) that you'll suffer wrath within the next 30 decaAut. On average, the wrath counter reaches 0 once every 0.5% of an experience level. That's an average of 10 retributions per XL per god. Owing penance to multiple gods means you will suffer wrath more frequently, but it will not last any longer.
Some gods inflict passive effects while under penance. For example, Ashenzari reduces your skills and makes enemy AI stronger; Elyvilon will randomly heal monsters about to die; Vehumet gives a 5% chance to get a miscast effect when casting destructive spells (but the spell still succeeds).
When a god's retribution is unleashed on you, it is possible for it to be "overwhelming". There is a chance given by: 
If (1 in 5) AND (XL < 1d37 - 1) pass, it is overwhelming.
If you are still worshipping the god in question, the Favour description in the religion screen (^) describes the amount of penance remaining:
|Godly wrath is upon you!||50+|
|You've transgressed heavily! Be penitent!||20+|
|You are under penance.||5+|
|You should show more discipline.||4 or less|
|... wrath is upon you!||greater than 75%|
|... well remembers your sins.||greater than 50%|
|... wrath is beginning to fade.||greater than 25%|
|... is almost ready to forgive your sins.
... wrath will not burn much longer. (Ignis only)
|less than 25%|
|... is neutral towards you.||0%|
The initial penance counter for abandonment depends on the god:
- 50 - Ashenzari, Beogh, Elyvilon, Goazag, Helpliaklqana, Lugonu, Nemelex Xobeh, Trog, and Xom ("Relatively long duration")
- 30 - Fedhas, Kikubaaqudgha, Jiyva, The Shining One, Sif Muna, and Yredelemnul
- 25 - Cheibriados, Dithmenos, Makhleb, Qazlal, Vehumet, Zin
- 15 - Ignis
For most gods, penance is reduced by:
- Piety gain. If you're still worshipping a god with penance, if you would get piety, it can be used to reduce penance instead.
- XP gain. Every time you'd receive a punishment through the wrath counter, penance is reduced by 1-3 (even if nothing actually happens).
- Certain gods' punishments can reduce penance by a greater amount.
- "Passive" effects, e.g. Vehumet miscast effects, don't decrement penance. If a god only has passive effects, penance is reduced by direct XP gain instead.
- If you leave and re-worship the god, penance will be reset (though your piety is reset, too). Only Lugonu prevents re-worship.
If the penance is reduced to zero, you will see the following message:
<god> seems mollified.
- Prior to 0.14, divine wrath was applied approximately once every 2000 turns, and could be waited out.
- Prior to 0.11, the check for retribution every 20 turns would first pick a god whose penance you were under, then determine if that god would exact vengeance upon you. Thus, when you were under penance from multiple gods, you would be under penance for longer, but you would experience a given angry god's wrath less often. This could be exploited to "dilute" particularly nasty god retributions in the early game, such as Lugonu's, by joining and abandoning multiple gods with more manageable retributions (such as Xom or Zin).
- Prior to 0.9, good gods would not place under penance followers who abandoned them for another good god. This was removed because it allowed players to choose which good god would exact retribution if they wanted to join an evil god. This technique was usually used to avoid the Shining One's wrath.