We present the first results from a major Hubble Space Telescope programme designed to investigate the cosmological evolution of quasar host galaxies from μ z≃ 2r to the present day. Here we describe J and H-band NICMOS imaging of two quasar samples at redshifts of 0.9 and 1.9 respectively. Each sample contains equal numbers of radio-loud and radio-quiet quasars, selected to lie within the same narrow range of optical absolute magnitude -24 ≥ MV ≥ -25. Filter and target selection were designed to ensure that at each redshift the images sample the same part of the object's rest-frame spectrum, longwards of 4000Å, where starlight from the host galaxy is relatively prominent, but avoiding potential contamination by [OIII]λ5007 and Hα emission lines. At z ≃ 1 we have been able to establish host-galaxy luminosities and scalelengths with sufficient accuracy to demonstrate that the hosts of both radio-loud and radio-quiet quasars lie on the same Kormendy relation described by 3CR radio galaxies at comparable redshift. Taken at face value the gap between the host luminosities of radio-loud and radio-quiet objects appears to have widened from only ~=0.4mag at z ≃ 0.2 to ~=1mag at z ≃ 1, a difference that cannot be a result of emission-line contamination, given the design of our study. However, within current uncertainties, simple passive stellar evolution is sufficient to link these galaxies with the elliptical hosts of low-redshift quasars of comparable nuclear output, implying that the hosts are virtually fully assembled by z ˜ 1. At z ≃ 2 the hosts have proved harder to characterize accurately, and for only two of the nine z ≃ 2 quasars observed has it proved possible to properly constrain the scalelength of the host galaxy. However, the data are of sufficient quality to yield host-galaxy luminosities accurate to within a factor of ~=2. At this redshift the luminosity gap between radio-loud and radio-quiet quasars appears to have widened further to ~=1.5mag. Thus while the hosts of radio-loud quasars remain consistent with a formation epoch of z > 3, allowing for passive evolution implies that the hosts of radio-quiet quasars are ≃ 2-4 times less massive at z ≃ 2 than at z ≃ 0.2. If the relationship between black hole and spheroid mass is unchanged out to redshift z ≃ 2, then our results rule out any model of quasar evolution which involves a substantial component of luminosity evolution. Rather, this study indicates that at z ≃ 2 there is a substantial increase in the number density of active black holes, along with a moderate increase in the fuelling efficiency of a typical observed quasar. The fact that this latter effect is not displayed by the radio-loud objects in our sample might be explained by a selection effect arising from the fact that powerful radio sources are only produced by the most massive black holes.