We study the dynamical equations of nonlinear inductor-capacitor circuits. We present a novel Lagrangian description of the dynamics and provide a variational interpretation, which is based on the maximum principle of optimal control theory. This gives rise to an alternative method for deriving the dynamic equations. We show how this generalized Lagrangian description is related to generalized Hamiltonian models discussed in the literature by means of a Legendre transformation. Some distinctive features of the present approach are that it is applicable to circuits with arbitrary topology and that the variational principle and the resulting equations do not involve nonphysical inductor charges or capacitor fluxe