The effect of a constant and uniform magnetic field on electrically conducting liquid-metal flow, in cylindrical cavities heated from below, is numerically analyzed by using a spectral element method to solve the three-dimensional Navier–Stokes and Ohm equations. The cavity is characterized by its aspect ratio defined as A=H/D. The lateral surfaces are adiabatic and all the boundaries are electrically insulating. The flow with a vertical magnetic field has the same symmetries as that without a magnetic field, so that similar convective modes (m=0, m=1, and m=2) occur, but they are not equally stabilized. Here m is the azimuthal wave number. For A=0.5, for sufficiently large values of the Hartmann number Ha, the mode m=2 becomes the critical mode in place of m=0. The horizontal magnetic field breaks some symmetries of the flow. The axisymmetric mode disappears giving an asymmetric mode m=02, i.e., a combination of the m=0 and m=2 modes, whereas the asymmetric modes (m=1 and m=2), which were invariant by azimuthal rotation without a magnetic field, now have two possible orientations, either parallel or perpendicular to the applied magnetic field B. These five modes are differently stabilized, weakly if the axis of the rolls is parallel to B and strongly if the axis is perpendicular. Beyond the primary thresholds, the secondary bifurcation, found in the pure thermal case for A=0.5, becomes an imperfect bifurcation consisting of two disconnected branches.