The nature of galaxies selected at submillimeter wavelengths (SMGs, S 850 3 mJy), some of the bolometrically most luminous objects at high redshifts, is still elusive. In particular their star formation histories and source of emission are not accurately constrained. In this paper we introduce a new approach to analyse the SMG data. Namely, we present the first self-consistent UV-to-radio spectral energy distribution fits of 76 SMGs with spectroscopic redshifts using all photometric datapoints from ultraviolet to radio simultaneously. We find that they are highly star-forming (median star formation rate 713 M yr −1 for SMGs at z > 0.5), moderately dust-obscured (median A V ∼ 2 mag), hosting significant stellar populations (median stellar mass 3.7 × 10 11 M ) of which only a minor part has been formed in the ongoing starburst episode. This implies that in the past, SMGs experienced either another starburst episode or merger with several galaxies. The properties of SMGs suggest that they are progenitors of present-day elliptical galaxies. We find that these bright SMGs contribute significantly to the cosmic star formation rate density (∼20%) and stellar mass density (∼30-50%) at redshifts 2-4. Using number counts at low fluxes we find that as much as 80% of the cosmic star formation at these redshifts took place in SMGs brighter than 0.1 mJy. We find evidence that a linear infrared-radio correlation holds for SMGs in an unchanged form up to redshift of 3.6, though its normalization is offset from the local relation by a factor of ∼2.1 towards higher radio luminosities. We present a compilation of photometry data of SMGs and determinations of cosmic SFR and stellar mass densities.