A method and a system for detection of an arrhythmia and discrimination between different types of arrhythmia to determine whether to administer an electric shock to the heart, the method comprising monitoring the electrical activity of a beating heart, selecting a number of heart beat intervals that will comprise an analysis segment determining an instantaneous heart rate for each of the heart beat intervals with the segment calculating the mean instantaneous heart rate for the segment determining the variability of the instantaneous heart rates compared to a mean using a linear combination of the mean and the non-linear value for comparison with a predetermined threshold to discriminate the type of arrhythmia to automatically decide if intervention is indicated.