Using a coupled atmosphere/ocean general circulation model, we have simulated the climatic response to natural and anthropogenic forcings from 1860 to 1997. The model, HadCM3, requires no flux adjustment and has an interactive sulphur cycle, a simple parameterization of the effect of aerosols on cloud albedo (first indirect effect), and a radiation scheme that allows explicit representation of well-mixed greenhouse gases. Simulations were carried out in which the model was forced with changes in natural forcings (solar irradiance and stratospheric aerosol due to explosive volcanic eruptions), well-mixed greenhouse gases alone, tropospheric anthropogenic forcings (tropospheric ozone, well-mixed greenhouse gases, and the direct and first indirect effects of sulphate aerosol), and anthropogenic forcings (tropospheric anthropogenic forcings and stratospheric ozone decline). Using an ``optimal detection'' methodology to examine temperature changes near the surface and throughout the free atmosphere, we find that we can detect the effects of changes in well-mixed greenhouse gases, other anthropogenic forcings (mainly the effects of sulphate aerosols on cloud albedo), and natural forcings. Thus these have all had a significant impact on temperature. We estimate the linear trend in global mean near-surface temperature from well-mixed greenhouse gases to be 0.9 +/- 0.24 K/century, offset by cooling from other anthropogenic forcings of 0.4 +/- 0.26 K/century, giving a total anthropogenic warming trend of 0.5 +/- 0.15 K/century. Over the entire century, natural forcings give a linear trend close to zero. We found no evidence that simulated changes in near-surface temperature due to anthropogenic forcings were in error. However, the simulated tropospheric response, since the 1960s, is ~50% too large. Our analysis suggests that the early twentieth century warming can best be explained by a combination of warming due to increases in greenhouse gases and natural forcing, some cooling due to other anthropogenic forcings, and a substantial, but not implausible, contribution from internal variability. In the second half of the century we find that the warming is largely caused by changes in greenhouse gases, with changes in sulphates and, perhaps, volcanic aerosol offsetting approximately one third of the warming. Warming in the troposphere, since the 1960s, is probably mainly due to anthropogenic forcings, with a negligible contribution from natural forcings.