Abstract Habitat fragmentation is one of the leading causes of population declines, threatening ecosystems worldwide. Freshwater taxa may be particularly sensitive to habitat loss as connectivity between suitable patches of habitat is restricted not only by the natural stream network but also by anthropogenic factors. Using a landscape genetics approach, we assessed the impact of habitat availability on population genetic diversity and connectivity of an endangered Australian freshwater fish Macquarie perch, Macquaria australasica (Percichthyidae). The relative contribution of anthropogenic versus natural in-stream habitat structures in shaping genetic structure and diversity in M. australasica was quite striking. Genetic diversity was significantly higher in locations with a higher river slope, a correlate of the species preferred habitat - riffles. On the other hand, barriers degrade preferred habitat and impede dispersal, contributing to the degree of genetic differentiation among populations. Our results highlight the importance of landscape genetics to understanding the environmental factors affecting freshwater fish populations and the potential practical application of this approach to conservation management of other freshwater organisms.