The impact of nonstarch polysaccharides (NSP) differing in their functional properties on intestinal bacterial community composition, prevalence of butyrate production pathway genes, and occurrence of Escherichia coli virulence factors was studied for eight ileum-cannulated growing pigs by use of terminal restriction fragment length polymorphism (TRFLP) and quantitative PCR. A cornstarch- and casein-based diet was supplemented with low-viscosity, low-fermentability cellulose (CEL), with high-viscosity, low-fermentability carboxymethylcellulose (CMC), with low-viscosity, high-fermentability oat beta-glucan (LG), and with high-viscosity, high-fermentability oat beta-glucan (HG). Only minor effects of NSP fractions on the ileal bacterial community were observed, but NSP clearly changed the digestion in the small intestine. Compared to what was observed for CMC, more fermentable substrate was transferred into the large intestine with CEL, LG, and HG, resulting in higher levels of postileal dry-matter disappearance. Linear discriminant analysis of NSP and TRFLP profiles and 16S rRNA gene copy numbers for major bacterial groups revealed that CMC resulted in a distinctive bacterial community in comparison to the other NSP, which was characterized by higher gene copy numbers for total bacteria, Bacteroides-Prevotella-Porphyromonas, Clostridium cluster XIVa, and Enterobacteriaceae and increased prevalences of E. coli virulence factors in feces. The numbers of butyryl-coenzyme A (CoA) CoA transferase gene copies were higher than those of butyrate kinase gene copies in feces, and these quantities were affected by NSP. The present results suggest that the NSP fractions clearly and distinctly affected the taxonomic composition and metabolic features of the fecal microbiota. However, the effects were more linked to the individual NSP and to their effect on nutrient flow into the large intestine than to their shared functional properties.