Background :The gut microbiota composition is influenced by diet as well as the environment in both wild and domestic animals. Although the rumen microbiome in herbivorous ruminants has been studied, the gut metagenome and the underlying ecological mechanisms of different feeding systems in extreme environment have not been elucidated. Here, the influence of two feeding systems, grazing and drylot, on the gut microbiome composition of Tibetan goats was investigated. These goats are a semi-feral highland breed that lives at an altitude of ~4800 m. 16S rRNA gene sequencing and metagenomic analysis was conducted using the gastrointestinal tract lumen and mucosa (rumen, cecum, and colon) samples obtained from yearling animals. Results: We observed distinct microbiome functions potential in the rumen and hindgut (cecum and colon). The peptidases, arginine and proline metabolism, oxidative phosphorylation, cysteine and methionine metabolism were highly enriched in the rumen microbiome. We demonstrated the proportion of Methanobrevibacter was significantly higher in the drylot group, thereby resulted in a higher abundance of enzymes involved in hydrogenotrophic methanogenesis. The core genera of Clostridium, Prevotella were observed in significantly different proportions between the two groups, these differences were reflective of the different nutrition metabolism between free-range and drylot animals. Although antimicrobial resistance in bacteria has been attributed to feeding conditions, the pasturing system did not affect the abundance of antibiotic resistance genes.Conclusions: Together, these results highlight the importance of hindgut microbiota in the process of nutrient metabolism, and provide ecological insights into establishment of the GIT microbiome in ruminants under a unique environmental system.