Postoperative atrial fibrillation (POAF) frequently complicates cardiac surgery and is associated with worse outcomes. The cardiac autonomic nervous system is implicated in the pathogenesis of POAF. The purpose of this study was to determine the efficacy and safety of selective cardiac autonomic modulation in preventing POAF. In this randomized, double-blind, placebo-controlled trial, adults undergoing cardiac surgery were randomized 1:1 to intraoperative injection of 250 units onabotulinumtoxinA (botulinum toxin type A [BoNTA]) or placebo into epicardial fat pads. The study was powered to detect a 40% reduction in relative risk of POAF. Time to first episode of in-hospital POAF was the primary outcome, evaluated in patients receiving injection. Additionally, incidence of POAF, length of stay (LOS), and adverse events were examined. The trial assigned 145 patients to injection, 15 of whom were dropped before treatment, leaving 130 patients for analysis. Overall, 36.5% (23/63) of BoNTA-treated patients developed POAF compared with 47.8% (32/67) of placebo-treated patients. The time-to-event analysis revealed a hazard ratio of 0.69 (95% confidence interval 0.41-1.19; P = .18) for the BoNTA vs placebo arm. There were no significant differences in postoperative hospital LOS (median [interquartile range] 6.0 [3.4] vs 6.2 [3.7] days; P=.51) or adverse events prolonging LOS (27/63 [42.9%] vs 30/67 [44.8%]; P = .83) in patients receiving BoNTA vs placebo. Epicardial injection of onabotulinumtoxinA was without discernible adverse effects, but we failed to detect a significant difference in risk of POAF. Future large-scale studies of epicardial onabotulinumtoxinA injection as a potential POAF prevention strategy should be designed to study smaller, but clinically meaningful, treatment effects.