Apparatus, consisting of a probe configured to be inserted into contact with a myocardium, and an electrode attached to the probe. A temperature sensor, incorporated in the probe, is configured to output a temperature signal. A pump irrigates the myocardium, via the probe, with an irrigation fluid at a controllable rate, and a radiofrequency (RF) signal generator applies RF power via the electrode to the myocardium, so as to ablate the myocardium. The apparatus also has processing circuitry that measures a temperature of the probe, based on the temperature signal, while the RF power is applied and, when the measured temperature exceeds a preset target temperature, iteratively reduces the RF power applied by the signal generator and concurrently iteratively varies a rate of irrigation of the irrigation fluid provided by the pump, until the measured temperature is reduced to the preset target temperature.