Anammox has been widely applied for treating high ammonia‑nitrogen leachate, but challenges remain due to the phosphorus in the wastewater and by-products nitrate (NO3−). Therefore, we combined partial denitrification-anammox and hydroxyapatite crystallization within a single UASB reactor. This method achieved an effluent with a 4.27 ± 0.45 mg TN/L and a maximum PO43− removal efficiency of 68.31 ± 5.42 %. The addition of excess calcium led to an increase in phenylalanine-like substances, the humification index (HIX) of extracellular polymeric substances (EPS), and the MLVSS/MLSS ratio. These changes indicated that hydroxyapatite coated the initial granular sludge, causing it to crack and re-granulate, but the MLVSS didn't decrease significantly. Therefore, calcium addition didn't significantly impact the function of biomass. Metagenomic analysis revealed that by-products NO3− was removed through partial denitrification using in-situ refractory dissolved organic matters in SL. The formation of hydroxyapatite crystals is the main pathway for PO43− removal, and biological process also contributed to some PO43− removal. Overall, our study provided a viable solution for the simultaneous removal of nitrogen and recovery of phosphorus from high ammonia‑nitrogen wastewater.