Marine records of sediment oxygen isotope compositions show that the Earth's climate has gone through a succession of glacial and interglacial periods during the past million years. But the interpretation of the oxygen isotope records is complicated because both isotope storage in ice sheets and deep-water temperature affect the recorded isotopic composition. Separating these two effects would require long records of either sea level or deep-ocean temperature, which are currently not available. Here we use a coupled model of the Northern Hemisphere ice sheets and ocean temperatures, forced to match an oxygen isotope record for the past million years compiled from 57 globally distributed sediment cores, to quantify both contributions simultaneously. We find that the ice-sheet contribution to the variability in oxygen isotope composition varied from ten per cent in the beginning of glacial periods to sixty per cent at glacial maxima, suggesting that strong ocean cooling preceded slow ice-sheet build-up. The model yields mutually consistent time series of continental mean surface temperatures between 40 and 80 degrees N, ice volume and global sea level. We find that during extreme glacial stages, air temperatures were 17 +/- 1.8 degrees C lower than present, with a 120 +/- 10 m sea level equivalent of continental ice present.