Context. Water is a key constituent of star-forming matter, but the origin of its line emission and absorption during high-mass star formation is not well understood. Aims. We study the velocity profiles of low-excitation H 2 O lines toward 19 high-mass star-forming regions and search for trends with luminosity, mass, and evolutionary stage. Methods. We decompose high-resolution Herschel-HIFI line spectra near 990, 1110 and 1670 GHz into three distinct physical components. Dense cores (protostellar envelopes) are usually seen as narrow absorptions in the H 2 O 1113 and 1669 GHz ground-state lines, the H 2 O 987 GHz excited-state line, and the H 18 2 O 1102 GHz ground-state line. In a few sources, the envelopes appear in emission in some or all studied lines, indicating higher temperatures or densities. Broader features due to outflows are usually seen in absorption in the H 2 O 1113 and 1669 GHz lines, in 987 GHz emission, and not seen in H 18 2 O, indicating a lower column density and a higher excitation temperature than the envelope component. A few outflows are detected in H 18 2 O, indicating higher column densities of shocked gas. In addition, the H 2 O 1113 and 1669 GHz spectra show narrow absorptions by foreground clouds along the line of sight. The lack of corresponding features in the 987 GHz and H 18 2 O lines indicates a low column density and a low excitation temperature for these clouds, although their derived H 2 O ortho/para ratios are close to 3. Results. The intensity of the ground state lines of H 2 O at 1113 and 1669 GHz does not show significant trends with source luminosity, envelope mass, or evolutionary state. In contrast, the flux in the excited-state 987 GHz line appears correlated with luminosity and the H 18 2 O line flux appears correlated with the envelope mass. Furthermore, appearance of the envelope in absorption in the 987 GHz and H 18 2 O lines seems to be a sign of an early evolutionary stage, as probed by the mid-infrared brightness and the L bol /M env ratio of the source. Conclusions. The ground state transitions of H 2 O trace the outer parts of the envelopes, so that the effects of star formation are mostly noticeable in the outflow wings. These lines are heavily affected by absorption, so that line ratios of H 2 O involving the ground states must be treated with caution, especially if multiple clouds are superposed as in the extragalactic case. The isotopic H 182 O line appears to trace the mass of the protostellar envelope, indicating that the average H 2 O abundance in high-mass protostellar envelopes does not change much with time. The excited state line at 987 GHz increases in flux with luminosity and appears to be a good tracer of the mean weighted dust temperature of the source, which may explain why it is readily seen in distant galaxies.