The study of structural and functional magnetic resonance imaging data has greatly benefitted from the development of sophisticated and efficient algorithms aimed at automating and optimizing the analysis of brain data. We address, in the context of the segmentation of brain from non-brain tissue (i.e., brain extraction, also known as skull-stripping), the tension between the increased theoretical and clinical interest in patient data, and the difficulty of conventional algorithms to function optimally in the presence of gross brain pathology. Indeed, because of the reliance of many algorithms on priors derived from healthy volunteers, images with gross pathology can severely affect their ability to correctly trace the boundaries between brain and non-brain tissue, potentially biasing subsequent analysis. We describe and make available an optimized brain extraction script for the pathological brain (optiBET) robust to the presence of pathology. Rather than attempting to trace the boundary between tissues, optiBET performs brain extraction by (i) calculating an initial approximate brain extraction; (ii) employing linear and non-linear registration to project the approximate extraction into the MNI template space; (iii) back-projecting a standard brain-only mask from template space to the subject's original space; and (iv) employing the back-projected brain-only mask to mask-out non-brain tissue. The script results in up to 94% improvement of the quality of extractions over those obtained with conventional software across a large set of severely pathological brains. Since optiBET makes use of freely available algorithms included in FSL, it should be readily employable by anyone having access to such tools.