Woody plant encroachment threatens grassland biomes at a global scale. Pyric herbivory combines prescribed burnings and targeted grazing to restore open habitats and has proved to be successful in promoting landscape and plant community diversity. However, less is known on the effects of pyric herbivory practices on belowground biodiversity. We evaluated the midterm effect on mesofauna, bacteria and fungi of prescribed burns and targeted horse grazing regimes implemented to restore a grassland encroached by gorse (Ulex gallii Planch.). We hypothesized that 1) low-intensity shrub-to shrub burnings had no effect or had a transient effect of low magnitude on soil microbial diversity, and that 2) targeted horse grazing after burning increased soil mesofauna and microbial diversity in the midterm. We established an experiment in two shrub-encroached grasslands in western Pyrenees with three treatments (no burning and no grazing as control, burning but no grazing, and burning and grazing). We measured soil properties and soil diversity of fungi and bacteria (DNA-metabarcoding) just after fire, and vegetation structure, soil properties and soil diversity of fungi, bacteria and mesofauna after two periods of targeted grazing (a year and a half after the burning). The response to pyric herbivory differed among soil organisms. Fungi were more sensitive to burning than bacteria, but both recovered a year and a half after burning –fungi only recovered in the presence of grazing–. Grazing increased soil fungi and bacteria diversity indexes (∼20 % and ∼5 % increase, respectively) at the two sites. A year and a half after burning, burned and ungrazed areas had a 30 % more mesofauna diversity than control areas whereas grazing of the burned areas decreased mesofauna diversity by 30 % at one of the sites compared to the control. Since the responses to pyric herbivory vary among soil organisms, a wide range of management intensities across space and time are recommended for maximizing soil biodiversity.