The paper suggests an explicit form of a general integral of motion for some classes of dynamical systems including n-degrees of freedom Euler–Lagrange systems subject to (n− 1) virtual holonomic constraints. The knowledge of this integral allows to extend the classical results due to Lyapunov for detecting a presence of periodic solutions for a family of second order systems, and allows to solve the periodic motion planning task for underactuated Euler–Lagrange systems, when there is only one not directly actuated generalized coordinate. As an illustrative example, we have shown how to create a periodic oscillation of the pendulum for a cart–pendulum system and how then to make them orbitally exponentially stable following the machinery developed in [A. Shiriaev, J. Perram, C. Canudas-de-Wit, Constructive tool for an orbital stabilization of underactuated nonlinear systems: virtual constraint approach, IEEE Trans. Automat. Control 50 (8) (2005) 1164–1176]. The extension here also considers time-varying virtual constraints. © 2006 Elsevier B.V. All rights reserved.