The atmospheres of white dwarfs, the last life stage of most stars ($\leq 8$ M$_\odot$), are expected to consist nearly entirely of hydrogen and helium. However, observations have revealed pollution by heavier elements in about a quarter to a half of all white dwarfs. While asteroids and dwarf planets have been identified as the typical sources of pollution, surprisingly, some observations have shown that pollution by larger planetary bodies (e.g., Mars-like or larger) or by icy material from Kuiper belt analog objects orbiting at great distances from the white dwarf can also occur. Here we report on a mechanism that utilizes the observed high binary fraction of stars, and naturally leads to the emergence of both of these observed features. We find that this mechanism readily explains and is consistent with observations.