The primary cause of most skin cancers is prolonged exposure to harmful UV rays, whether from the sun or artificial sources.