Aims We aimed to identify the incidence and risk factors for first ever atrial fibrillation among patients with newly diagnosed heart failure following initial heart failure diagnosis. Methods A heart failure inception cohort of patients aged 20–89 years without atrial fibrillation or cancer (N = 14 457) from 2000 to 2005 was identified from The Health Improvement Network primary care database in the United Kingdom and followed for a mean of 2.67 years. First ever cases of atrial fibrillation were identified and controls (N = 3000) were frequency matched to cases by age and sex. Odds ratios (ORs) with 95% confidence intervals (CIs) were estimated using unconditional logistic regression. Results One thousand four hundred and eighty-nine patients (10.3%) developed a first episode of atrial fibrillation: incidence rate 27.3/1000 person-years. A three-fold increased risk of atrial fibrillation was seen in the first 6 months after heart failure diagnosis, OR 3.62 (95% CI: 2.97–4.42) with the risk decreasing thereafter. Other risk factors were excessive alcohol consumption (OR 2.91, 1.60–5.30) and valvular heart disease (OR 1.98, 1.63–2.40) and use of oral steroids (OR 1.76, 95% CI: 1.40–2.22). Reduced risks of atrial fibrillation were found with use of statins (OR 0.65, 95% CI: 0.56–0.76) and β-blockers (OR 0.78, 95% CI: 0.67–0.91). Conclusions The incidence of first ever atrial fibrillation among newly diagnosed heart failure patients is high, especially in the first 6 months after diagnosis. This time relationship, together with the identified risk factors for atrial fibrillation, warrants consideration in the medical care of patients with heart failure.