Background: Biofilms, when formed on the surfaces of water pipes, can be responsible for a wide range of water quality and operational problems. We sought to assess the bacterial and free-living protozoa (FLP) diversity, in relation to the presence of Legionnaire's disease-causing bacteria Legionella pneumophila (L. pneumophila) in 45 biofilms of hot water distribution system pipes of apartment buildings in Riga, the capital city of Latvia.Results: 16S rRNA amplicon sequencing (metataxonomics) revealed that each biofilm contained 224 rather evenly distributed bacterial genera and that most common and most abundant were two genera, completely opposites in terms of their oxygen requirements: the obligately anaerobic Thermodesulfovibrio and the strictly aerobic Phenylobacterium. Water temperature and north-south axis (i.e., different primary water sources) displayed the most significant effect on the inter-sample variations, allowing us to re-construct three sub-networks (modules) of co-occurring genera, one involving (potentially FLP-derived) Legionella spp. Pangenome-based functional profile predictions suggested that all three may be dominated by pathways related to the development and maintenance of biofilms, including quorum sensing and nutrient transport, as well as the utilization of various energy sources, such as carbon and nitrogen. In our 18S rRNA amplicon sequencing data, potential hosts of L. pneumophila were detected in 11 out of 12 biofilm samples analyzed, however, in many cases, their relative abundance was very low (<1%). By validating our findings using culture-based methods, we detected L. pneumophila (serogroups 2, 3, 6 and 9) in nine (20%) biofilms, whereas FLP (mostly Acanthamoeba, Vahlkampfidae and Vermamoeba spp.) were present in six (~13%) biofilms. In two biofilms, L. pneumophila and its potential hosts were detected simultaneously, using culture-based methods.Conclusions: Overall, our study sheds light on the community diversity of hot water biofilms and predicts how several environmental factors, such as water temperature and source might shape it.