A colectomy is a surgical procedure involving the removal of all or part of the colon. It is often performed to treat conditions such as colon cancer, diverticulitis, or inflammatory bowel disease. In the context of cancer, a colectomy is primarily used to remove cancerous tumors from the colon, thereby preventing the spread of cancer and alleviating symptoms.