In a porcine cystic fibrosis model, lack of cystic fibrosis transmembrane conductance regulator (CFTR) is shown to result in acidification of airway surface liquid (ASL), and this decrease in pH reduces the ability of ASL to kill bacteria; the findings directly link loss of the CFTR anion channel to impaired defence against bacterial infection. The discovery of a link between cystic fibrosis and mutations in the CFTR (cystic fibrosis transmembrane conductance regulator) gene has stimulated two decades of extensive research. As a result, the genetic, functional and cellular aspects of CFTR are well known. But despite these advances, it has proved impossible to relate the pathogenesis of bacterial lung infection, the major cause of morbidity and mortality in the disease, to the basic physiological abnormality — the loss of CFTR anion channels. The experiments reported here show that without CFTR, when airway epithelial HCO3 secretion is defective, the pH of the airway surface liquid falls and inhibits antimicrobial function. This impairs the killing of bacteria that enter the lungs. Reducing the pH of the airway surface layer diminished bactericidal activity in wild-type pigs, whereas increasing the pH restored antimicrobial activity in pigs lacking CFTR. These findings link CFTR mutations to defective bacterial eradication, and suggest that increasing the pH of the airway surface liquid might prevent the initial infection in patients with cystic fibrosis. Cystic fibrosis (CF) is a life-shortening disease caused by mutations in the cystic fibrosis transmembrane conductance regulator (CFTR) gene1. Although bacterial lung infection and the resulting inflammation cause most of the morbidity and mortality, how the loss of CFTR function first disrupts airway host defence has remained uncertain2,3,4,5,6. To investigate the abnormalities that impair elimination when a bacterium lands on the pristine surface of a newborn CF airway, we interrogated the viability of individual bacteria immobilized on solid grids and placed onto the airway surface. As a model, we studied CF pigs, which spontaneously develop hallmark features of CF lung disease7,8. At birth, their lungs lack infection and inflammation, but have a reduced ability to eradicate bacteria8. Here we show that in newborn wild-type pigs, the thin layer of airway surface liquid (ASL) rapidly kills bacteria in vivo, when removed from the lung and in primary epithelial cultures. Lack of CFTR reduces bacterial killing. We found that the ASL pH was more acidic in CF pigs, and reducing pH inhibited the antimicrobial activity of ASL. Reducing ASL pH diminished bacterial killing in wild-type pigs, and, conversely, increasing ASL pH rescued killing in CF pigs. These results directly link the initial host defence defect to the loss of CFTR, an anion channel that facilitates HCO3− transport9,10,11,12,13. Without CFTR, airway epithelial HCO3− secretion is defective, the ASL pH falls and inhibits antimicrobial function, and thereby impairs the killing of bacteria that enter the newborn lung. These findings suggest that increasing ASL pH might prevent the initial infection in patients with CF, and that assaying bacterial killing could report on the benefit of therapeutic interventions.