Karst ecosystems are widely distributed around the world, accounting for 15-20% of the global land area. However, knowledge on microbial ecology of these systems does not match with their global importance. To close this knowledge gap, we sampled three niches including weathered rock, sediment, and drip water inside the Heshang Cave and three types of soils overlying the cave (forest soil, farmland soil, and pristine karst soil). All these samples were subjected to high-throughput sequencing of V4-V5 region of 16S rRNA gene and analyzed with multivariate statistical analysis. Overall, archaeal communities were dominated by Thaumarchaeota, whereas Actinobacteria dominated bacterial communities. Thermoplasmata, Nitrosopumilaceae, Aenigmarchaeales, Crossiella, Acidothermus, and Solirubrobacter were the important predictor groups inside the Heshang Cave, which were correlated to NH4 + availability. In contrast, Candidatus Nitrososphaera, Candidatus Nitrocosmicus, Thaumarchaeota Group 1.1c, and Pseudonocardiaceae were the predictors outside the cave, whose distribution was correlated with pH, Ca2+, and NO2 -. Tighter network structures were found in archaeal communities than those of bacteria, whereas the topological properties of bacterial networks were more similar to those of total prokaryotic networks. Both chemolithoautotrophic archaea (Candidatus Methanoperedens and Nitrosopumilaceae) and bacteria (subgroup 7 of Acidobacteria and Rokubacteriales) were the dominant keystone taxa within the co-occurrence networks, potentially playing fundamental roles in obtaining energy under oligotrophic conditions and thus maintaining the stability of the cave ecosystem. To be noted, all the keystone taxa of karst ecosystems were related to nitrogen cycling, which needs further investigation, particularly the role of archaea. The predicted ecological functions in karst soils mainly related to carbohydrate metabolism, biotin metabolism, and synthesis of fatty acid. Our results offer new insights into archaeal ecology, their potential functions, and archaeal interactions with bacteria, which enhance our understanding about the microbial dark matter in the subsurface karst ecosystems.