A simple model of energy confinement in tokamaks is proposed. In this model, the temperature and current profiles are determined by tearing mode stability considerations. As a result, the global energy confinement becomes strongly dependent on the boundary energy transport. A higher edge temperature ensures a higher core temperature and hence a higher global energy confinement.