A mastectomy is surgery to remove 1 or both breasts. It is performed either to treat or to prevent breast cancer.