When performed using an exhaustive search, the maximum likelihood (ML) joint detection of all users in a multicarrier code-division multiple-access (MC-CDMA) system has a prohibitive complexity, growing exponentially with the number of users and the number of bits in each modulation symbol. In this paper, a novel ML multiuser detection algorithm is proposed, the complexity of which is a polynomial function of the number of users and is independent of the modulation size. The MC-CDMA system is modeled as a sphere packing lattice and a low-complexity optimum lattice decoder, the sphere decoder, is applied to jointly detect all users. Suboptimum simplifications, based on the orthogonal projection of the received signal on a facet of the lattice constellation, are also proposed to further decrease the complexity. Simulation results are shown with up to 64 users transmitting 16-quadrature-amplitude modulation symbols.