It is largely the result of selection acting on variants that arrived through migration over the past five to ten thousand years.

Cheddar Man, with his dark skin and his Western Hunter-Gatherer ancestry, is a data point that fits perfectly into this picture: a Mesolithic European, ten thousand years ago, before the Neolithic migration had substantially modified the European gene pool, still carrying the darker pigmentation that was characteristic of the population that inhabited Europe in the glacial and early postglacial period.

The Specific Genes Involved

The genetic basis of skin pigmentation in humans involves many genes, each contributing a small amount to the total variation in skin color.