Atrial fibrillation (AF) after cardiac surgery is associated with increased risk of complications, length of stay, and cost of care. Observational evidence suggests that patients who have undergone previous statin therapy have a lower incidence of postoperative AF. We tested this observation in a randomized, controlled trial. Two hundred patients undergoing elective cardiac surgery with cardiopulmonary bypass, without previous statin treatment or history of AF, were enrolled. Patients were randomized to atorvastatin (40 mg/d, n=101) or placebo (n=99) starting 7 days before operation. The primary end point was incidence of postoperative AF; secondary end points were length of stay, 30-day major adverse cardiac and cerebrovascular events, and postoperative C-reactive protein (CRP) variations. Atorvastatin significantly reduced the incidence of AF versus placebo (35% versus 57%, P=0.003). Accordingly, length of stay was longer in the placebo versus atorvastatin arm (6.9+/-1.4 versus 6.3+/-1.2 days, P=0.001). Peak CRP levels were lower in patients without AF (P=0.01), irrespective of randomization assignment. Multivariable analysis showed that atorvastatin treatment conferred a 61% reduction in risk of AF (odds ratio 0.39, 95% confidence interval 0.18 to 0.85, P=0.017), whereas high postoperative CRP levels were associated with increased risk (odds ratio 2.0, 95% confidence interval 1.2 to 7.0, P=0.01). The incidence of major adverse cardiac and cerebrovascular events at 30 days was similar in the 2 arms. Treatment with atorvastatin 40 mg/d, initiated 7 days before surgery, significantly reduces the incidence of postoperative AF after elective cardiac surgery with cardiopulmonary bypass and shortens hospital stay. These results may influence practice patterns with regard to adjuvant pharmacological therapy before cardiac surgery.