Steel casings are cemented in wellbores to ensure that the production of oil and gas can be controlled during the operation of the well and at the well-bore end of life. The sealing properties of the cement are essential in this respect. Loading history during construction and operation of the well and long-term material behavior characteristics may affect the integrity of the cement and its sealing capacity. Several failure potential modes are identified: cracking of cement, shear failure of cement, de-bonding of cement and casing and de-bonding of cement and rock. In this paper a nonlinear, staggered, heat-transfer-stress analysis for both 2-dimensional and 3-dimensional models is presented. The analysis simulates and evaluates the sealing properties of the cement and calculates the chance that one or more of the failure modes occurs. In the analysis both the construction phases of the well and typical loadings during operation, such as over-pressures and temperature changes, as well as abandonment phase, are considered. Some examples of numerical models are presented and discussed.