Confounding occurs when the effect of the primary exposure on an outcome is mixed with the effect of another variable, known as a confounder. This can lead to a misleading association between the exposure and the outcome. A confounder is typically associated with both the exposure and the outcome but is not an intermediate step in the causal pathway.