Medical treatment of heart failure reduces risk of arrhythmia, but an implantable cardioverter-defibrillator may be used to prevent death due to sudden arrhythmia in patients who continue to have a reduced ejection fraction despite optimal medical therapy.