Generational curses – what the Bible says

Exodus 20:5-6 are the oft quoted verses where God talks about curses on the father flowing through to the children to the third and fourth generation. Indeed there are multiple examples through the Bible where generations after the one that sinned paid the price for historical sins. But limiting our understanding of these verses to this explanation would be inconsistent with the rest of the Bible. Ezekiel 18:20 and Deut 24:16 specifically say that the son shall not suffer for the iniquity of the father or vice versa. As the Bible doesn’t contradict itself, there’s more to study.