A method and an apparatus for treating cardiac arrhythmias are provided. An interval between first and second consecutive beats of a heart, having first and second chamber types, is determined. The heart is paced at a first rate if the first beat is from the first chamber type and the second beat is from the second chamber type and the interval is less than a predetermined amount of time or if the first and second beats are both from the second chamber type. The heart is paced at a second rate if the first beat is from the first chamber type and the second beat is from the second chamber type and the interval is more than the predetermined amount of time.