A fistulectomy is needed to treat anal fistulas, which can cause pain, discomfort, swelling, and discharge. It aims to promote healing and prevent complications.