A mechanism of damped oscillations of a coronal loop is investigated. The loop is treated as a thin toroidal flux rope with two stationary photospheric footpoints, carrying both toroidal and poloidal currents. The forces and the flux-rope dynamics are described within the framework of ideal magnetohydrodynamics (MHD). The main features of the theory are the following: i) Oscillatory motions are determined by the Lorentz force that acts on curved current-carrying plasma structures and ii) damping is caused by drag that provides the momentum coupling between the flux rope and the ambient coronal plasma. The oscillation is restricted to the vertical plane of the flux rope. The initial equilibrium flux rope is set into oscillation by a pulse of upflow of the ambient plasma. The theory is applied to two events of oscillating loops observed by the Transition Region and Coronal Explorer (TRACE). It is shown that the Lorentz force and drag with a reasonable value of the coupling coefficient (c d ) and without anomalous dissipation are able to accurately account for the observed damped oscillations. The analysis shows that the variations in the observed intensity can be explained by the minor radial expansion and contraction. For the two events, the values of the drag coefficient consistent with the observed damping times are in the range c d ≈ 2 -5, with specific values being dependent on parameters such as the loop density, ambient magnetic field, and the loop geometry. This range is consistent with a previous MHD simulation study and with values used to reproduce the observed trajectories of coronal mass ejections (CMEs).