Biliary tract cancer or extrahepatic cholangiocarcinoma (ECCA) represents the sixth commonest cause of cancer in the gastrointestinal tract in western countries. We aimed to characterize the microbiota and its predicted associated functions in the biliary tract of ECCA and benign biliary pathology (BBP). Samples were taken from 100 patients with ECCA and 100 patients with BBP by endoscopic cholangio-pancreatography for DNA extraction. Ten patients with ECCA and ten with BBP were selected for microbiota studies using the V4-16S rRNA gene and sequenced in Illumina platform. Microbiota analyses included sample-to-sample distance metrics, ordination/clustering and prediction of functions. Presence of Nesterenkonia sp. and Helicobacter pylori cagA and vacA genes were tested in the 100 ECCA and 100 BBP samples. Phylum Proteobacteria dominated all samples (60.4% average). Ordination multicomponent analyses showed significant microbiota separation between ECCA and BBP (p 0.010). Analyses of 4002 operational taxonomic units with presence variation in at least one category probed a separation of ECCA from BBP. Among these, Nesterenkonia decreased, whereas Methylophilaceae, Fusobacterium, Prevotella, Actinomyces, Novosphingobium and H. pylori increased in ECCA. Predicted associated functions showed increased abundance of H. pylori virulence genes in ECCA. cagA and vacA genes were confirmed by PCR in ECCA and BBP samples. This is the first microbiota report in ECCA and BBP to show significant changes in microbial composition. Bacterial species unusual for human flora were found: Methylophilaceae and Nesterenkonia are reported in hypersaline soils, and Mesorhizobium is a nitrogen-fixing bacterium. Enrichment of virulence genes confirms previous studies suggesting that H. pylori might be associated with ECCA. Copyright © 2015 European Society of Clinical Microbiology and Infectious Diseases. Published by Elsevier Ltd. All rights reserved.