Melanin is produced in two forms: pheomelanin and eumelanin. Pheomelanin produces the colors red and yellow, which are found in various combinations with eumelanin in fair skinned people. Eumelanin produces dark brown and black colors, which are found in various combinations with pheomelanin in dark skinned people. To put it differently, pheomelanin is dominant in the skin coloring of light skinned people while eumelanin is dominant in the skin coloring of dark skinned people.
A 2004 study from Yale University states that the connection between melanin and susceptibility to skin cancers is that pigmentation that is dominant in pheomelanin is irritated by UV rays while pigmentation that is dominant in eumelanin does not have the same reaction to UV rays:
the source of their skin and hair pigmentation, melanin, actually magnifies the damaging effects of ultraviolet (UV) rays, ("Melanin Makes Skin Vulnerable to Harmful Ultraviolet Rays," Yale)
In light skinned people, particularly those who also have light colored hair, UV rays actually cause "cell death" at the hair follicle cells. Douglas Brash, the principal investigator of the study, concluded that while melanin can be protective against UV it can also be harmful since, in fair skinned people, the UV ray effects are actually amplified (increased) to the point of leading to follicle cell death and increased risk for the occurrence of skin cancer.
"What this tells us is that melanin is not only good for you, it also can be bad. It depends on the color of your particular melanin," Brash said.