One aspect of the invention is to provide a method for detecting cardiac events, such as for example Atrial Fibrillation (AF) or termination of the AF. The method is based on the analysis of the instability observed in the heart rate, known to be caused by irregular conduction from the atrium during an episode of AF. Change in the heart interval is monitored on a beat-to-beat basis in an attempt to recognize the instability that indicates presence of an Atrial Fibrillation or Atrial Flutter. According to a first step of the inventive method, a packet of a number of consecutive intervals is evaluated, whether the length of an interval is stable compared with the length of the preceding interval, or whether the length of the subsequent interval has changed. After detection of an instability, an instability counter is incremented. The result of the stability test for a packet of intervals is represented by the value of the instability counter. Depending upon whether or not an Atrial Fibrillation (AF) is already declared, which is indicated by an AF status flag, different "X-out-of-Y" criterion are applied. The AF status flag is set or cleared when declaring an AF or when declaring termination of an AF respectively.