  We examine the hydromagnetic stability of magnetically confined mountains,
which arise when material accumulates at the magnetic poles of an accreting
neutron star. We extend a previous axisymmetric stability analysis by
performing three-dimensional simulations using the ideal-magnetohydrodynamic
(ideal-MHD) code \textsc{zeus-mp}, investigating the role played by boundary
conditions, accreted mass, stellar curvature, and (briefly) toroidal magnetic
field strength. We find that axisymmetric equilibria are susceptible to the
undular sub-mode of the Parker instability but are not disrupted. The
line-tying boundary condition at the stellar surface is crucial in stabilizing
the mountain. The nonlinear three-dimensional saturation state of the
instability is characterized by a small degree of nonaxisymmetry ($\la 0.1$ per
cent) and a mass ellipticity of $\epsilon \sim 10^{-5}$ for an accreted mass of
$M_a = 10^{-5} M_\odot$. Hence there is a good prospect of detecting
gravitational waves from accreting millisecond pulsars with long-baseline
interferometers such as Advanced LIGO. We also investigate the ideal-MHD
spectrum of the system, finding that long-wavelength poloidal modes are
suppressed in favour of toroidal modes in the nonaxisymmetric saturation state.
