  We apply methods of the so-called `inverse problem of the calculus of
variations' to the stabilization of an equilibrium of a class of
two-dimensional controlled mechanical systems. The class is general enough to
include, among others, the inverted pendulum on a cart and the inertia wheel
pendulum. By making use of a condition that follows from Douglas'
classification, we derive feedback controls for which the control system is
variational. We then use the energy of a suitable controlled Lagrangian to
provide a stability criterion for the equilibrium.
