Joint species distribution models have become ubiquitous for studying species-habitat relationships and dependence among species. Accounting for community structure often improves predictive power, but can also alter inference on species-habitat relationships. Modulated species-habitat relationships are indicative of community confounding: The situation in which interspecies dependence and habitat effects compete to explain species distributions. We discuss community confounding in a case study of mammalian responses to the Colorado bark beetle epidemic in the subalpine forest by comparing the inference from independent single species distribution models and a joint species distribution model. We present a method for measuring community confounding and develop a restricted version of our hierarchical model that orthogonalizes the habitat and species random effects. Our results indicate that variables associated with the severity and duration of the bark beetle epidemic suffer from community confounding. This implies that mammalian responses to the bark beetle epidemic are governed by interconnected habitat and community effects. Disentangling habitat and community effects can improve our understanding of the ecological system and possible management strategies. We evaluate restricted regression as a method for alleviating community confounding and distinguish it from other inferential methods for confounded models.