Fathers shall not be put to death because of sons, nor shall sons be put to death because of fathers; each man shall be put to death for his own transgression.
Here is a passuk most people are familiar with. However, while reading last week's parsha (Shelach), I noticed an intriguing passuk that seems to contradict the above statement in Devarim.
'The Lord is slow to anger and abundantly kind, forgiving iniquity and transgression, Who cleanses [some] and does not cleanse [others], Who visits the iniquities of parents on children, even to the third and fourth generations.'
(The translation of the passukim are from Chabad.org)
There is something I do not understand here. G-d says he punishes the children for the sins of their parents to the third and fourth generations, but later says that if a father sins, the children should not be held accountable and vice-versa. Am I missing something here? I checked in Rashi but he does not comment on the seemingly apparent contradiction.