This paper introduces a 3D MRI segmentation algorithm based on Hidden Markov Models (HMMs). The mathematical models for the HMM that forms the basis of the segmentation algorithm for both the continuous and discrete cases are developed and contrasted with Hidden Markov Random Field in terms of complexity and extensibility to larger fields. The presented algorithm clearly demonstrates the capacity of HMM to tackle multi-dimensional classification problems. The HMM-based segmentation algorithm was evaluated through application to simulated brain images from the McConnell Brain Imaging Centre, Montréal Neurological Institute, McGill University as well as real brain images from the Internet Brain Segmentation Repository (IBSR), Harvard University. The HMM model exhibited high accuracy in segmenting the simulated brain data and an even higher accuracy when compared to other techniques applied to the IBSR 3D MRI data sets. The achieved accuracy of the segmentation results is attributed to the HMM foundation and the utilization of the 3D model of the data. The IBSR 3D MRI data sets encompass various levels of difficulty and artifacts that were chosen to pose a wide range of challenges, which required handling of sudden intensity variations and the need for global intensity level correction and 3D anisotropic filtering. During segmentation, each class of MR tissue was assigned to a separate HMM and all of the models were trained using the discriminative MCE training algorithm. The results were numerically assessed and compared to those reported using other techniques applied to the same data sets, including manual segmentations establishing the ground truth for real MR brain data. The results obtained using the HMM-based algorithm were the closest to the manual segmentation ground truth in terms of an objective measure of overlap compared to other methods.