Abstract. We present molecular line observations made with the IRAM 30-m telecopes of the immediate surroundings of a sample of 11 candidate high-mass protostars. These observations are part of an effort to clarify the evolutionary status of a set of objects which we consider to be precursors of UC Hii regions. In a preceding series of papers we have studied a sample of objects, which on the basis of their IR colours are likely to be associated with compact molecular clouds. The original sample of 260 objects was divided approximately evenly into a High group, with IR colour indices [25−12] ≥ 0.57 and [60−12] ≥ 1.3, and a Low group with complementary colours. The FIR luminosity of the Low sources, their distribution in the IR colour-colour diagram, and their lower detection rate in H2O maser emission compared to the High sources, led to the hypothesis that the majority of these objects represent an earlier stage in the evolution than the members of the High group, which are mostly identifiable with UC Hii regions. Subsequent observations led to the selection of 12 Low sources that have FIR luminosities indicating the presence of B2.5 to O8.5 V0 stars, are associated with dense gas and dust, have (sub-)mm continuum spectra indicating temperatures of ∼30 K, and have no detectable radio continuum emission. One of these sources has been proposed by us to be a good candidate for the high-mass equivalent of a Class 0 object. In the present paper we present observations of the molecular environment of 11 of these 12 objects, with the aim to derive the physical parameters of the gas in which they are embedded, and to find further evidence in support of our hypothesis that these sources are the precursors to UC Hii regions. We find that the data are consistent with such an interpretation. All observed sources are associated with well-defined molecular clumps. Masses, sizes, and other parameters depend on the tracer used, but typically the cores have average diameters of ∼0.5-1 pc (with a range of 0.2 to 2.2 pc), and masses of a few tens to a few thousand solar masses. Compared to a similar analysis of High sources, the present sample has molecular clumps that are more massive, larger, cooler, and less turbulent. They also tend to have a smaller ratio of virial-to-luminous mass, indicating they are less dynamically stable than their counterparts in which the High sources are embedded. The large sizes suggest these clumps should still undergo substantial contraction (their densities are ∼10 times smaller than those of the High sources). The lower temperatures and small linewidths are also expected in objects in an earlier evolutionary state. In various sources indications are found for outflowing gas, though its detection is hampered by the presence of multiple emission components in the line spectra. There are also signs of self-absorption, especially in the spectra of 13 CO and HCO + . We find that the masses of the molecular clumps associated with our objects increase with L fir (M clump ∝ L 1.17 fir ), and that there i...