The Hg released from coal mining activities can endanger soil ecosystems and pose a risk to human health. Understanding the accumulation characteristics of mercury (Hg) in coal mining soil is important for effectively controlling Hg emissions and developing measures for the prevention and control of Hg contamination. To identify the potential sources of Hg in soils, the Hg concentration and isotopic composition characteristics of raw coal and different topsoil types from the areas surrounding a coal mine were determined in this study. The results showed that Hg in coal mainly exists mainly in the form of inorganic Hg, and Hg has experienced Hg2+ photoreduction prior to incorporating into coal. In addition, the composition of Hg isotopes differed significantly among different topsoil types, and the δ202Hg value of the farmland soil exhibited large negative excursions compared to the coal mining soil. The ternary mixed model further revealed the presence of substantial differences in potential Hg sources among the two regions, with the coal mining soil being greatly disturbed by anthropogenic activity, and the relative contributions of Hg from raw coal, coal gangue, and background soil to coal mining soil being 33.42%, 34.4%, and 32.19%, respectively. However, Hg from raw coal, coal gangue and background soil contributed 17.04%, 21.46%, and 61.51% of the Hg in the farmland soil, indicating that the accumulation of Hg in farmland soil was derived primarily from the background soil. Our study demonstrated that secondary pollution in soil caused by immense accumulation of solid waste (gangue) by mining activities offers a significant challenge to ecological security. These findings provide new insights into controlling soil Hg in mining areas and further highlight the urgency of strict protective measures for contaminated sites.