We study a generalized isotropic XY model which includes both two- and four-spin mean-field interactions. This model can be solved in the microcanonical ensemble. It is shown that in certain parameter regions the model exhibits gaps in the magnetization at fixed energy, resulting in ergodicity breaking. This phenomenon has previously been reported in anisotropic and discrete spin models. The entropy of the model is calculated and the microcanonical phase diagram is derived, showing the existence of first-order phase transitions from the ferromagnetic to a paramagnetic disordered phase. It is found that ergodicity breaking takes place in both the ferromagnetic and paramagnetic phases. As a consequence, the system can exhibit a stable ferromagnetic phase within the paramagnetic region, and conversely a disordered phase within the magnetically ordered region.