Integrated urban water management is a well-accepted concept for managing urban water. It requires efficient and integrated technological solutions that enable system-wide gains via a whole-of-system approach. Here, we create a solid link between the manufacturing of an iron salt, its application in an urban water system, and high-quality bioenergy recovery from wastewater. An iron-oxidising electrochemical cell is used to remove CO2 (also H2S and NH3) from biogas, thus achieving biogas upgrading, and simultaneously producing FeCO3. The subsequent dose of the electrochemically produced FeCO3 to wastewater and sludge removes sulfide and phosphate, and enhances sludge settleability and dewaterability, with comparable or superior performance compared to the imported and hazardous iron salts it substitutes (FeCl2, and FeCl3). The process enables water utilities to establish a self-reliant and more secure supply chain to meet its demand for iron salts, at lower economic and environmental costs, and simultaneously achieve recovery of high-quality bioenergy.