Human origin is in the equatorial zone of Africa. In these latitudes, UVB radiation is at its most intense. UVB radiation at the equator strikes the earth at a 90 degree angle, penetrating the ozone layer at its thinnest point. While all humans have the same average number of melanocytes, these melanocytes are genetically programmed to produce different amounts of melanin in different individuals. The melanin layer diffuses the UVB radiation and prevents its penetration to the lower skin levels where it could cause cancer.
Melanomas are rapid-spreading cancers which can kill within a few years of their occurrence.
In order to survive in the equatorial zones, humans had to have very heavy pigmentation. Therefore, the first humans were heavily pigmented. If the first humans were heavily pigmented, you may wonder why not all humans are still heavily pigmented. The reason for this also relates to UVB radiation. Curiously enough, the effects of UVB radiation are not all negative.