In the field of built heritage, the removal of reddish-brown and greenish stains presents a complex challenge frequently encountered by experts. Consequently, numerous studies strive to develop sustainable and respectful cleaning methods for conserving stone materials in their original esthetic state. In pursuit of this objective, agar hydrogels were here investigated as solid support, capitalizing on their slow-release capability and capacity to store chemical species. As chelating and biocidal loading, three different ionic liquids (ILs) (trihexyltetradecylphosphonium chloride (TP), bis(2-ethylhexyl) phosphate (BP), and Alicy (AL) and a mixture of Aliquat 336 and Cyanex 272 were tested for the controlled removal of iron and copper stains. The homogeneity and cleaning effectiveness of the different loaded agar hydrogels were assessed on artificial stains using a combination of micro-energy dispersive X-ray fluorescence (µ-ED-XRF) and Raman imaging analyses. The spectroscopic data were supported by inductively coupled plasma atomic emission spectroscopy (ICP-AES) and colorimetric measurements. Additionally, the inhibitory effect on microbial growth of the most effective treatments was tested prior to their in situ application on naturally stained stones. The results indicated that agar provides suitable solid support to apply ILs, specifically highlighting the strong affinity of AL and BP for sequestering iron and copper ions, respectively, from stained stone surfaces. Furthermore, the disk-diffusion results evidenced that the proposed treatments could play a bi-functional role if a biocidal action is required to remove biological colonization, reaching nwhalo average values in the range of 0.6 - 0.8 against Micrococcus Luteus. Thus, this study showcases the potential of agar hydrogels loaded with ILs as a sustainable and gentle cleaning method in built heritage conservation.