This paper presents a general framework for analysing condition based replacement policies for stochastically failing units. The framework is based on the theory of counting processes. A replacement policy minimizing the long run expected cost is determined. The paper discusses both non-repairable and repairable units. Two examples are analysed in detail: shock models and monotone (coherent) systems. (C) 1996 Elsevier Science Limited.