The primary cause of cervical cancer is infection with the human papillomavirus (HPV), particularly high-risk types like HPV 16 and 18, which are linked to most cervical cancer cases.