Increasing temperatures and variability of precipitation events due to climate change will lead in the future to higher irrigation demands in agroecosystems. However, the use of secondary treated wasterwater (TWW) could have consequences for the receiving soil environment and its resident microbial communities. The objective of this study was to characterize the importance of soil properties and habitats to the response of soil bacteria and archaea to irrigation with TWW. Two agricultural soils with contrasting textures (loamy sand or silt loam) and, for each, three variants differing in soil organic carbon and nitrogen, as generated by long-term fertilization, were analyzed. For each of these six soils, prokaryotic communities from two habitats, i.e., root-free bulk soil and the rhizosphere of developing cucumber plants in the greenhouse, were characterized. Communities were analyzed by the quantity and diversity of their polymerase chain reaction (PCR)-amplified 16S rRNA genes. To account for TWW-associated nutrient effects, potable water (PW) served as a control. Amplicon sequence analysis showed that prokaryotic communities mainly consisted of bacteria (99.8%). Upon irrigation, regardless of the water quality, prokaryotic diversity declined, pH increased, and no bacterial growth was detected in bulk soil. In contrast, the growth of cucumbers was stimulated by TWW, indicating that plants were the main beneficiaries. Moreover, strong responses were seen in the rhizosphere, suggesting an indirect effect of TWW by altered rhizodepositions. The main bacterial responders to TWW were Proteobacteria, Bacteroidetes, Actinobacteria, and Planctomycetes. Changes in bacterial communities due to TWW were less pronounced in all variants of the silt loam, indicating the importance of clay and soil organic carbon for buffering effects of TWW on soil bacterial communities. Hence, soil organic carbon and soil texture are important parameters that need to be considered when applying TWW in agriculture. © 2020 Soil Science Society of China