Aims: We investigate whether solar coronal mass ejections are driven mainly by coupling to the ambient solar wind or through the release of internal magnetic energy. Methods: We examine the energetics of 39 flux-rope like coronal mass ejections (CMEs) from the Sun using data in the distance range $sim$ 2--20 $R_{odot}$ from the Large Angle Spectroscopic Coronograph (LASCO) aboard the Solar and Heliospheric Observatory (SOHO). This comprises a complete sample of the best examples of flux-rope CMEs observed by LASCO in 1996-2001. Results: We find that 69% of the CMEs in our sample experience a clearly identifiable driving power in the LASCO field of view. For the CMEs that are driven, we examine if they might be deriving most of their driving power by coupling to the solar wind. We do not find conclusive evidence in favor of this hypothesis. On the other hand, we find that their internal magnetic energy is a viable source of the required driving power. We have estimated upper and lower limits on the power that can possibly be provided by the internal magnetic field of a CME. We find that, on average, the lower limit to the available magnetic power is around 74% of what is required to drive the CMEs, while the upper limit can be as much as an order of magnitude larger.