A generalization of the age replacement policy is proposed and analysed. Under such a policy, if an operating system fails at age y•t, it is either replaced by a new system (type II failure) with probability p(y), or it undergoes minimal repair (type I faiulure) with probability q(y)=1-p(y). Otherwise, a system is replaced when the first failure after t occurs or the total operating time reaches age T (0•t•T), whichever occurs first. The cost of the ith minimal repair of a system at age y depends on the random part C(y) and the deterministic part ci(y). The aim of the paper is to find the optimal (t*,T*) which minimizes the long-run expected cost per unit time of the policy. Various special cases are included and a numerical example is finally given.