The linear equation for ideal magnetohydrodynamic ballooning modes in three-dimensional configurations is derived in the coordinate system that is optimal for the representation of the equilibrium state. The magnetic field lines in this coordinate system, however, are not straight. The form of the Mercier criterion that is currently in use is recovered from the asymptotic analysis of the ballooning equation. To determine the parallel-current density, a magnetic differential equation expressed in the optimal coordinates must be inverted. (C) 2000 MAIK "Nauka/Interperiodica".