In the local Universe, most galaxies are dominated by stars, with less than ten per cent of their visible mass in the form of gas. Determining when most of these stars formed is one of the central issues of observational cosmology. Optical and ultraviolet observations of high-redshift galaxies (particularly those in the Hubble Deep Field) have been interpreted as indicating that the peak of star formation occurred between redshifts of 1 and 1.5. But it is known that star formation takes place in dense clouds, and is often hidden at optical wavelengths because of extinction by dust in the clouds. Here we report a deep submillimetre-wavelength survey of the Hubble Deep Field; these wavelengths trace directly the emission from dust that has been warmed by massive star-formation activity. The combined radiation of the five most significant detections accounts for 30-50 per cent of the previously unresolved background emission in this area. Four of these sources appear to be galaxies in the redshift range 2< z < 4, which, assuming these objects have properties comparable to local dust-enshrouded starburst galaxies, implies a star-formation rate during that period about a factor of five higher than that inferred from the optical and ultraviolet observations.